public async Task <ResponseModel> UpdateCategory(int id, Lemontech.DataLayer.Models.Category model) { try { _context.Entry(model).State = EntityState.Modified; await _context.SaveChangesAsync(); return(new ResponseModel { Message = "Update Category Successful", Status = "Success" }); } catch (Exception) { return(new ResponseModel { Code = 400, Message = "Update Category Failed", Status = "Failed" }); } }
public async Task <ResponseModel> CreateCategory(Lemontech.DataLayer.Models.Category model) { try { _context.Category.Add(model); await _context.SaveChangesAsync(); return(new ResponseModel { Message = "Create Category Successful", Status = "Success" }); } catch (Exception) { return(new ResponseModel { Code = 400, Message = "Create Category Failed", Status = "Failed" }); } }