public bool DeleteAward(string userId, string awardId) { try { //Validate user if (_userRepository.IsAuthenticated(userId)) { //GetUserProfile var award = _awardRepository.GetAwardById(awardId); if (award != null) { //Success var isDeleted = _awardRepository.DeleteAward(award.Id.ToString()); if (isDeleted) { return(_awardRepository.Save()); } } _loggingService.Info("Not profile for the user found: " + userId); } _loggingService.Info("UserId Authenticated Failed: " + userId); } catch (Exception ex) { //Error _loggingService.Error("An error has occurred", ex); } //Fail return(false); }
public bool DeleteAward(int AwardId) { try { _repository.DeleteAward(AwardId); } catch { return(false); } return(true); }
public ActionResult DeleteConfirmed(int id) { try { Repository.DeleteAward(id); Repository.Save(); } catch (DataException) { return(RedirectToAction("Delete", new { id, V = true })); } return(RedirectToAction("Index")); }