Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using ASP.Common.Data.DTO.REvolve;
- using System.Linq;
- //-------------------------------------------------------------------------------------------------------
- // <auto-generated>
- // This code was generated by EntitiesToDTOs.v3.3.0.0 (entitiestodtos.codeplex.com).
- // Timestamp: 2018.03.26 - 14:57:34
- //
- // Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
- // </auto-generated>
- //-------------------------------------------------------------------------------------------------------
- using System.Collections.Generic;
- using ASP.Common.Data.Model;
- using System;
- namespace ASP.Common.Data.ClientLoader.Assemblers.REvolve
- {
- /// <summary>
- /// Assembler for <see cref="ControlActions"/> and <see cref="C_Control_ActionsDTO"/>.
- /// </summary>
- public static partial class ControlActionsAssembler
- {
- /// <summary>
- /// Invoked when <see cref="ToDTO"/> operation is about to return.
- /// </summary>
- /// <param name="dto"><see cref="C_Control_ActionsDTO"/> converted from <see cref="C_Control_Actions"/>.</param>
- static partial void OnDTO(this ControlActions model, C_Control_ActionsDTO dto);
- /// <summary>
- /// Invoked when <see cref="ToModel"/> operation is about to return.
- /// </summary>
- /// <param name="model"><see cref="ControlActions"/> converted from <see cref="C_Control_ActionsDTO"/>.</param>
- static partial void OnModel(this C_Control_ActionsDTO dto, ControlActions model);
- /// <summary>
- /// Converts this instance of <see cref="C_Control_ActionsDTO"/> to an instance of <see cref="ControlActions"/>.
- /// </summary>
- /// <param name="dto"><see cref="C_Control_ActionsDTO"/> to convert.</param>
- public static ControlActions ToModel(this C_Control_ActionsDTO dto)
- {
- if (dto == null) return null;
- var cache = ClientEFCache.GetInstance();
- var model = cache.GetItem<ControlActions>(dto.ID_Control_Actions);
- if (model != null)
- return model;
- model = new ControlActions();
- model.Id = dto.ID_Control_Actions;
- model.Name = dto.Control_Name;
- model.ActionDelete = dto.Action_Delete;
- model.ActionExecute = dto.Action_Execute;
- model.ActionWrite = dto.Action_Write;
- model.Status = dto.Status;
- model.DateModified = dto.Datum_azur;
- model.UserModified = dto.User_azur;
- cache.Add(model);
- dto.OnModel(model);
- return model;
- }
- /// <summary>
- /// Converts this instance of <see cref="ControlActions"/> to an instance of <see cref="C_Control_ActionsDTO"/>.
- /// </summary>
- /// <param name="model"><see cref="ControlActions"/> to convert.</param>
- public static C_Control_ActionsDTO ToDTO(this ControlActions model)
- {
- if (model == null) return null;
- var dto = new C_Control_ActionsDTO();
- dto.ID_Control_Actions = model.Id ?? default(int);
- dto.Control_Name = model.Name;
- dto.ID_Activity = model.Activity?.Id ?? default(int);
- dto.Action_Delete = model.ActionDelete ?? default (bool);
- dto.Action_Execute = model.ActionExecute ?? default(bool);
- dto.Action_Write = model.ActionWrite ?? default (bool);
- dto.Status = model.Status ?? default (bool);
- dto.Datum_azur = model.DateModified ?? default(DateTime);
- dto.User_azur = model.UserModified;
- model.OnDTO(dto);
- return dto;
- }
- /// <summary>
- /// Converts each instance of <see cref="C_Control_ActionsDTO"/> to an instance of <see cref="ControlActions"/>.
- /// </summary>
- /// <param name="dtos"></param>
- /// <returns></returns>
- public static List<ControlActions> ToModels(this IEnumerable<C_Control_ActionsDTO> dtos)
- {
- if (dtos == null) return null;
- return dtos.Select(e => e.ToModel()).ToList();
- }
- /// <summary>
- /// Converts each instance of <see cref="ControlActions"/> to an instance of <see cref="C_Control_ActionsDTO"/>.
- /// </summary>
- /// <param name="models"></param>
- /// <returns></returns>
- public static List<C_Control_ActionsDTO> ToDTOs(this IEnumerable<ControlActions> models)
- {
- if (models == null) return null;
- return models.Select(e => e.ToDTO()).ToList();
- }
- }
- partial class ControlActionsAssembler
- {
- static partial void OnModel(this C_Control_ActionsDTO dto, ControlActions model)
- {
- model.Activity = dto.ID_Activity.To<Classification>();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement