public JsonResponse Modify(Product Product) { JsonResponse json = new JsonResponse(); if (ModelState.IsValid) { db.Entry(Product).State = EntityState.Modified; db.SaveChanges(); json.Data = Product; return(json); } json.Data = Product; json.Error = $"Product ID {Product.Id} does not exist"; return(json); }
public JsonResponse Modify(Customer customer) { JsonResponse json = new JsonResponse(); if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); json.Data = customer; return(json); } json.Data = customer; json.Error = $"Customer ID {customer.Id} does not exist"; return(json); }
public JsonResponse Modify(Employee Employee) { JsonResponse json = new JsonResponse(); if (ModelState.IsValid) { db.Entry(Employee).State = EntityState.Modified; db.SaveChanges(); json.Data = Employee; return(json); } json.Data = Employee; json.Error = $"Employee ID {Employee.Id} does not exist"; return(json); }