public IActionResult Delete(Title title) { var result = _titleService.Delete(title); if (result.Success) { return(Ok(result.Message)); } return(BadRequest(result.Message)); }
// POST: /BasicDataManagement/Professional/Delete/ public ActionResult Delete() { Title[] datas = ClassConvert <Title> .Process(Request.Form); foreach (var data in datas) { var result = _titleService.Delete(data); if (result.ResultType != OperationResultType.Success) { return(Json(new { error = result.ResultType.GetDescription(), total = datas.Length, data = datas })); } } return(Json(new { total = datas.Length, data = datas }, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteConfirmed(Guid id) { try { _Service.Delete(id); return(RedirectToAction("Index")); } catch (Exception e) { ModelState.AddModelError(string.Empty, e.GetOriginalException().Message); } var model = _Service.FindView(id); if (model == null) { return(HttpNotFound()); } return(View(model)); }
public HttpResponseMessage DeleteTitle([FromBody] string id) { Guid output; var isValid = Guid.TryParse(id, out output); if (!isValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid Title Id.")); } var result = _titleService.GetById(output); if (result == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "Invalid Title Id.")); } _titleService.Delete(result); var response = Request.CreateResponse(HttpStatusCode.NoContent); return(response); }
public IHttpActionResult Delete(int id, int userId) { int result = _service.Delete(id, userId); return(Ok()); }