// GET: Milestones/Delete/5 public ActionResult Delete(int id) { // TODO: Add delete logic here var Milestone = _repo.FindById(id); if (Milestone == null) { return(NotFound()); } var isSuccess = _repo.Delete(Milestone); if (!isSuccess) { return(BadRequest()); } return(RedirectToAction(nameof(Index))); }
public async Task <ActionResponse> RemoveItem(string milestoneId) { Mdls.Milestone milestone = await milestoneRepository.Get(milestoneId); if (milestone != null) { bool isOwner = milestone.UserId == currentAuthenticationContext.CurrentUser; if (isOwner) { bool deleted = await milestoneRepository.Delete(milestoneId); bool awsdeleted = await amazonS3ImageProvider.Delete($"milestones/{milestone.UserId}/{milestone.id}/img.png"); return(new ActionResponse { State = deleted }); } } return(new ActionResponse { State = false }); }
public void Delete(Milestone milestone) { _milestoneRepository.Delete(milestone); }
/// <summary> /// Deletes the Milestone from the system with the /// given ID and returns the record that was removed /// </summary> /// <param name="id">The ID of the Milestone to be deleted</param> /// <returns>The ID of the record to delete</returns> public Milestone DeleteMilestone(int id) { //Run the appropriate validations ValidateMilestoneExistsAndIsNotCompleted(id); return(milestoneRepository.Delete(id)); }