public IActionResult Add(OrdersViewModel ordersViewModel) { ordersViewModel.orders.Datecreation = DateTime.Now; db.Orders.Add(ordersViewModel.orders); db.SaveChanges(); return(RedirectToAction("Index", "orders")); }
public IActionResult Delete(int id) { db.Orders.Remove(db.Orders.Find(id)); db.SaveChanges(); return(RedirectToAction("index")); }