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 static bool Insert(Guid id, string name, Guid catID) { try { using (var context = new GeopersonContext()) { var model = ItemSubCategoryVM.Set(id, name, catID, false); context.ItemSubCategoryDB.Add(model); context.SaveChanges(); return(true); } } catch { return(false); } }