public IActionResult DeletePhoto(int Id, string AlbumEncrypted) { Photos p = photoRepository.DeletePhoto(Id); //return RedirectToAction("AlbumDetail", new RouteValueDictionary(new { controller = "User", action = "AlbumDetail", albumId = AlbumEncrypted })); LMCommon.DeletePhoto(p.PhotoPath, hostingEnvironment.WebRootPath, configuration["PhotoPath"]); toastNotification.AddSuccessToastMessage("Image Delete Successfully"); return(RedirectToAction("AlbumDetail", new RouteValueDictionary(new { controller = "User", action = "AlbumDetail", albumId = AlbumEncrypted }))); }
public IActionResult DeletePhoto(uint id, string username) { if (_photoService.DeletePhoto(id, username)) { return(Ok()); } return(NotFound()); }
public IHttpActionResult RemovePhoto(int photo_id) { int i = photorepo.DeletePhoto(photo_id); if (i >= 1) { return(Ok("Succesfully Removed")); } else { return(BadRequest("Refresh Site")); } }
public ActionResult DeletePhoto(int photo_id) { int i = photorepo.DeletePhoto(photo_id); if (i >= 1) { return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } }
/// <summary> /// DELETE current user /// </summary> /// <param name="UserId"></param> /// <returns>all users view</returns> public async Task <IActionResult> DeleteUser(string UserId) { AccountUser user = await userManager.Users.Include(i => i.AlbumList).ThenInclude(r => r.PhotoList).Where(user => user.Id == UserId).FirstOrDefaultAsync(); //user.AlbumList = user.AlbumList.ToList(); // List<Album> albums= albumRepository.GetUserAlbums(user.Id); if (user != null && user.AlbumList.Count > 0) { foreach (var item in user.AlbumList.ToList()) { foreach (var item2 in item.PhotoList.ToList()) { LMCommon.DeletePhoto(item2.PhotoPath, hostingEnvironment.WebRootPath, configuration["PhotoPath"]); photoRepository.DeletePhoto(item2.Id); } albumRepository.Delete(item.Id); } } await userManager.DeleteAsync(user); return(RedirectToAction("AllUsers")); }
public ActionResult DeletePhoto(Guid id) { _photoRepository.DeletePhoto(id); return(RedirectToAction("Photos", "AdminPhoto")); }