public async Task <JsonResult> GetByID(string id) { try { var data = ItemSubCategoryService.GetByID(Guid.Parse(id)); return(Success(ItemSubCategoryVM.MToVM(data))); } catch { return(Failed(MessageUtility.ServerError())); } }
public async Task <JsonResult> Update() { try { var id = Guid.Parse(Request.Form["id"]); var name = Request.Form["name"]; var archive = Boolean.Parse(Request.Form["archived"]); if (ItemSubCategoryService.Update(id, name, archive)) { return(Success("")); } return(Failed(MessageUtility.ServerError())); } catch { return(Failed(MessageUtility.ServerError())); } }
public async Task <JsonResult> Insert() { try { var id = Guid.NewGuid(); var name = Request.Form["name"]; var catID = Guid.Parse(Request.Form["catID"]); if (ItemSubCategoryService.Insert(id, name, catID)) { return(Success(id.ToString())); } return(Failed(MessageUtility.ServerError())); } catch { return(Failed(MessageUtility.ServerError())); } }