示例#1
0
 public BranchDTO CreateBranch(BranchDTO instance)
 {
     return Branch.AddOrUpdateBranch(instance.ToEntity()).ToDTO();
 }
示例#2
0
文件: Core.DTO.cs 项目: wangn6/rep2
        /// <summary>
        /// Invoked when <see cref="ToDTO"/> operation is about to return.
        /// </summary>
        /// <param name="dto"><see cref="BranchDTO"/> converted from <see cref="Branch"/>.</param>
partial         static void OnDTO(this Branch entity, BranchDTO dto);
示例#3
0
 public BranchDTO UpdateBranch(string id, BranchDTO instance)
 {
     return Branch.UpdateBranch(int.Parse(id), instance).ToDTO();
 }
示例#4
0
文件: Core.DTO.cs 项目: wangn6/rep2
        /// <summary>
        /// Converts this instance of <see cref="Branch"/> to an instance of <see cref="BranchDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="Branch"/> to convert.</param>
        public static BranchDTO ToDTO(this Branch entity)
        {
            if (entity == null) return null;

            var dto = new BranchDTO();

            dto.BranchId = entity.BranchId;
            dto.Name = entity.Name;
            dto.Description = entity.Description;
            dto.Path = entity.Path;
            dto.ProductId = entity.ProductId;

            entity.OnDTO(dto);

            return dto;
        }