public JsonResult RemoveBlob(string file, string extension) { //todo get file name bool isDeleted = repo.DeleteBlob(file); return(Json(isDeleted, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Deletes photo from blob storage and deletes name from database. /// </summary> /// <param name="memberId">The member identifier.</param> /// <param name="userId">The user identifier.</param> /// <returns></returns> public bool DeletePhoto(int?memberId = null, string userId = null) { if (memberId != null) { var member = unitOfWork.MemberRepository.FindById(memberId); string photoFileName = member.PhotoFileName; member.PhotoFileName = null; unitOfWork.MemberRepository.Update(member); return(blobRepo.DeleteBlob(photoFileName)); } else if (userId != null) { var user = unitOfWork.AppUserRepository.FindUserById(userId); user.PhotoFileName = null; unitOfWork.AppUserRepository.Update(user); return(blobRepo.DeleteBlob(user.PhotoFileName)); } return(false); }