Exemplo n.º 1
0
 public BranchDTO CreateBranch(BranchDTO instance)
 {
     return Branch.AddOrUpdateBranch(instance.ToEntity()).ToDTO();
 }
Exemplo n.º 2
0
        /// <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);
Exemplo n.º 3
0
 public BranchDTO UpdateBranch(string id, BranchDTO instance)
 {
     return Branch.UpdateBranch(int.Parse(id), instance).ToDTO();
 }
Exemplo n.º 4
0
        /// <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;
        }