public async Task <ActionResult <ReleaseViewModel> > UpdateRelease(ReleaseUpdateViewModel request, Guid releaseId) { return(await _releaseService .UpdateRelease(releaseId, request) .HandleFailuresOrOk()); }
public async Task <Either <ActionResult, ReleaseViewModel> > UpdateRelease( Guid releaseId, ReleaseUpdateViewModel request) { return(await _persistenceHelper .CheckEntityExists <Release>(releaseId, ReleaseChecklistService.HydrateReleaseForChecklist) .OnSuccess(_userService.CheckCanUpdateRelease) .OnSuccessDo(async release => await ValidateReleaseSlugUniqueToPublication(request.Slug, release.PublicationId, releaseId)) .OnSuccess(async release => { release.Slug = request.Slug; release.Type = request.Type; release.ReleaseName = request.ReleaseName; release.TimePeriodCoverage = request.TimePeriodCoverage; release.PreReleaseAccessList = request.PreReleaseAccessList; _context.Releases.Update(release); await _context.SaveChangesAsync(); return await GetRelease(releaseId); })); }