public ActionResult <IEnumerable <string> > EditAccountersDoor([FromBody] AddAccountersDoor form, Guid PartId) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var AccountersDoor = _context.AccountersDoor.Where(x => x.Id == PartId).FirstOrDefault(); AccountersDoor.AccounDoor_Info = form.AccounDoor_Info; AccountersDoor.AccounDoor_Name = form.AccounDoor_Name; AccountersDoor.AccounDoor_Status = form.AccounDoor_Status; _context.Entry(AccountersDoor).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(Ok(new Response { Message = "Done !", Data = AccountersDoor, Error = false })); }
public ActionResult <IEnumerable <string> > AddAccountersDoor([FromBody] AddAccountersDoor form) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var NewAccountersDoor = new AccountersDoor { AccounDoor_Info = form.AccounDoor_Info, AccounDoor_Name = form.AccounDoor_Name, AccounDoor_Status = form.AccounDoor_Status }; _context.AccountersDoor.Add(NewAccountersDoor); _context.SaveChanges(); return(Ok(new Response { Message = "Done !", Data = NewAccountersDoor, Error = false })); }