public BuildDTO Update(string id, BuildDTO instance) { int buildId = Int32.Parse(id); instance.BuildId = buildId; return Build.Update(buildId, instance).ToDTO(); }
/// <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);
public BuildDTO Create(BuildDTO instance) { return Build.Add(instance.ToEntity()).ToDTO(); }
/// <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; }