public IActionResult Delete(Guid id) { try { if (_service.HasChildren(id)) { return(Json(new { Result = "Faild", Message = "Please delete the subordinate categories first!" })); } else { _service.Delete(id); return(Json(new { Result = "Success" })); } } catch (Exception ex) { return(Json(new { Result = "Faild", Message = ex.Message })); } }
public async Task <JsonResult> Delete(string id, string userId) { var result = await _categoryAppService.Delete(id, userId); OutputModel outputModel = new OutputModel(); outputModel.Data = result; return(new JsonResult(outputModel)); }
public IActionResult Delete([FromBody] CategoryViewModel model) { if (!ModelState.IsValid) { return(BadRequest()); } var categoryViewModel = _categoryAppService.Delete(model.Id); return(Ok(categoryViewModel)); }
public ActionResult Delete(Guid id) { try { _categoryService.Delete(id, _currentUser.CurrentUserId); return(Json(1, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(-1, JsonRequestBehavior.AllowGet)); } }
public ActionResult Delete(long id) { try { //Delete _categoryService.Delete(id); //Successfully message this.AddToastMessage(string.Format(Messages.RecordDeletedSuccessfully, "category"), ToastType.Success); } catch (CustomException ex) { this.AddToastMessage(ex.Message, ToastType.Error); } catch (Exception ex) { this.AddToastMessage(Messages.GeneralError, ToastType.Error); } return(RedirectToAction("Index")); }
public IActionResult Delete(Guid id) { _categoryAppService.Delete(id); return(Response()); }
public IActionResult DeleteConfirmed(Guid id) { _categoryAppService.Delete(id); return(RedirectToAction("Index")); }