public BranchDTO CreateBranch(BranchDTO instance) { return Branch.AddOrUpdateBranch(instance.ToEntity()).ToDTO(); }
/// <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);
public BranchDTO UpdateBranch(string id, BranchDTO instance) { return Branch.UpdateBranch(int.Parse(id), instance).ToDTO(); }
/// <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; }