public JsonResult Delete(int id) { var apiResult = TryExecute(() => { _softwareRepository.Delete(id); _unitOfWork.Commit(); return(true); }, "Software deleted sucessfully"); return(Json(apiResult, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage DeleteSoftware(int id) { try { _softwareRepository.Delete(id); HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); return(response); } catch (Exception) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NotFound); return(response); } }
/// <summary> /// The Delete /// </summary> /// <param name="entity">The entity<see cref="Software"/></param> /// <returns>The <see cref="ServiceResult"/></returns> public ServiceResult Delete(Software entity) { try { _repository.Delete(entity); return(new ServiceResult(true)); } catch (Exception ex) { return(new ServiceResult(false) { Error = ex.ToString() }); } }
public Message Delete(int softwareId) { var message = new Message(); try { int result = _iSoftwareRepository.Delete(softwareId); if (result > 0) { message = Message.SetMessages.SetSuccessMessage("Software Deleted Successfully."); } else { message = Message.SetMessages.SetErrorMessage("Failed to Delete Data."); } } catch (Exception ex) { message = Message.SetMessages.SetErrorMessage(ex.Message); } return(message); }