public IActionResult CreateOrderItems(OrderItems orders) { if (ModelState.IsValid) { repo.Create(orders); return(Redirect("ViewOrderItems")); } return(View("CreateOrderItems")); }
public JsonResult AjaxCreate(Orders_Items orderItem) { if (Authorized(RoleType.OrdersWriter)) { bool wasCreated; using (OrderItemsRepository itemRep = new OrderItemsRepository(CurrentUser.CompanyId, orderItem.SupplierId)) { wasCreated = itemRep.Create(orderItem); } if (wasCreated) return Json(new { success = true, message = String.Empty, newItemId = orderItem.Id }, JsonRequestBehavior.AllowGet); else return Json(new { success = false, message = Loc.Dic.error_supplier_item_create_error }, JsonRequestBehavior.AllowGet); } else { return Json(new { success = false, message = Loc.Dic.error_no_permission }, JsonRequestBehavior.AllowGet); } }
public JsonResult AjaxCreate(Orders_Items orderItem) { if (Authorized(RoleType.OrdersWriter)) { bool wasCreated; using (OrderItemsRepository itemRep = new OrderItemsRepository(CurrentUser.CompanyId, orderItem.SupplierId)) { wasCreated = itemRep.Create(orderItem); } if (wasCreated) { return(Json(new { success = true, message = String.Empty, newItemId = orderItem.Id }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = Loc.Dic.error_supplier_item_create_error }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { success = false, message = Loc.Dic.error_no_permission }, JsonRequestBehavior.AllowGet)); } }