public async Task UpdateContent(UpdateContentDTO input) { var c = await _repository.GetById(input.Id); c.IsHomePage = input.IsHomePage; c.IsCampaign = input.IsCampaign; if (!string.IsNullOrEmpty(input.MainImageURL)) { c.MainImageURL = input.MainImageURL; } if (!string.IsNullOrEmpty(input.SlideImageURL)) { c.SlideImageURL = input.SlideImageURL; } if (!string.IsNullOrEmpty(input.VideoURL)) { c.VideoURL = input.VideoURL; } if (!string.IsNullOrEmpty(input.AudioURL)) { c.AudioURL = input.AudioURL; } c.Name = input.Name; c.Title = input.Title; c.Description = input.Description; c.Text = input.Text; c.CreatedTime = input.CreatedTime; await _repository.Update(c.Id, c); }
public async Task <IActionResult> UpdateContent(UpdateContentDTO input) { try { await _contentService.UpdateContent(input); return(Ok()); } catch (Exception) { throw; } }
public async Task <IActionResult> Update(UpdateContentViewModel input) { try { string mainImageUrl = await _blobManager.UploadImageAsBlob(input.MainImage); string slideImageUrl = await _blobManager.UploadImageAsBlob(input.SlideImage); string videoUrl = await _blobManager.UploadImageAsBlob(input.Video); string audioUrl = await _blobManager.UploadImageAsBlob(input.Audio); UpdateContentDTO data = new UpdateContentDTO() { Id = input.Id, Name = input.Name, Description = input.Description, Title = input.Title, MainImageURL = mainImageUrl, SlideImageURL = slideImageUrl, VideoURL = videoUrl, AudioURL = audioUrl, IsHomePage = input.IsHomePage, IsCampaign = input.IsCampaign, Text = input.Text, CreatedTime = DateTime.Now, LocationId = input.LocationId }; await _contentService.UpdateContent(data); return(RedirectToAction(nameof(Index))); } catch (Exception e) { throw e; } }