public IActionResult EditPhoto(EditPhotoViewModel epvm) { if (!ModelState.IsValid) { return(View()); } Photo photo = _photoRepository.GetphotoByID(epvm.PhotoId); if (photo == null) { return(RedirectToAction("Index")); } if (photo.NRAKOUserId != CurrentUser.Id && !(IsAdmin)) { return(RedirectToAction("Index")); } photo.DateModified = DateTime.Now; photo.Description = epvm.Description; string[] hashtags = epvm.Hashtags.Split(' '); _photoRepository.RemovePhotoHashTags(photo.Id); _photoRepository.AddHashtagsToPhoto(hashtags, photo.Id); _logger.Log(CurrentUser.Id, $"Edited photo @{photo.Url}, Description: {photo.Description}, Hashtags: {epvm.Hashtags}"); return(RedirectToAction("Index")); }