public string Delete(string UserId) { Profile profile = Get(UserId); if (_repo.Delete(UserId)) { return("Deleted."); } throw new Exception("Delete Failed."); }
public string Delete(int id) { Profile exists = _repo.Get(id); if (exists == null) { throw new Exception("Invalid Id"); } _repo.Delete(id); return("Successfully Deleted"); }
// Only user/author can delete // Probably easier to handle validation in Repository // Leaving similar to Keep.Delete for now...since it appears the keepr-testing-tool needs confimation. internal string Delete(int id, string userId) { Profile foundProfile = GetProfileById(id, userId); if (foundProfile.UserId != userId) { throw new Exception("This is not your Profile!"); } if (_repo.Delete(id, userId)) { return("successfully deleted."); } throw new Exception("Something unexpected happened."); }