示例#1
0
 public BuildDTO Update(string id, BuildDTO instance)
 {
     int buildId = Int32.Parse(id);
     instance.BuildId = buildId;
     return Build.Update(buildId, instance).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="BuildDTO"/> converted from <see cref="Build"/>.</param>
partial         static void OnDTO(this Build entity, BuildDTO dto);
示例#3
0
 public BuildDTO Create(BuildDTO instance)
 {
     return Build.Add(instance.ToEntity()).ToDTO();
 }
示例#4
0
文件: Core.DTO.cs 项目: wangn6/rep2
        /// <summary>
        /// Converts this instance of <see cref="Build"/> to an instance of <see cref="BuildDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="Build"/> to convert.</param>
        public static BuildDTO ToDTO(this Build entity)
        {
            if (entity == null) return null;

            var dto = new BuildDTO();

            dto.BuildId = entity.BuildId;
            dto.ProviderId = entity.ProviderId;
            dto.ProductId = entity.ProductId;
            dto.Name = entity.Name;
            dto.Type = entity.Type;
            dto.Status = entity.Status;
            if (entity.BranchId != null)
            {
                dto.Branch = Branch.GetBranchById(entity.BranchId.Value).Name;
            }
            if (entity.ReleaseId != null)
            {
                dto.Release = Release.GetReleaseById(entity.ReleaseId.Value).Name;
            }
            dto.Number = entity.Number;
            dto.Location = entity.Location;
            dto.Description = entity.Description;

            entity.OnDTO(dto);

            return dto;
        }