/// <summary> /// Deprecated Method for adding a new object to the InventoryActions EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToInventoryActions(InventoryAction inventoryAction) { base.AddObject("InventoryActions", inventoryAction); }
public JsonResult CreateInventoryAction(InventoryActionModel model) { if (!ModelState.IsValid) { return Json(new { Result = "ERROR", Message = "Form is not valid! " + "Please correct it and try again." }); } if (!User.IsInRole("Officer")) { return Json(new { Result = "ERROR", Message = "You do not have the authority to create a new inventory action." }); } try { JourListDMContainer dm = new JourListDMContainer(); InventoryAction item = new InventoryAction(); item.Description = model.Description; dm.AddToInventoryActions(item); dm.SaveChanges(); model.Id = item.Id; return Json(new { Result = "OK", Record = model }); } catch (Exception e) { return Json(new { Result = "ERROR", Message = e.Message }); } }
/// <summary> /// Create a new InventoryAction object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="description">Initial value of the Description property.</param> public static InventoryAction CreateInventoryAction(global::System.Int32 id, global::System.String description) { InventoryAction inventoryAction = new InventoryAction(); inventoryAction.Id = id; inventoryAction.Description = description; return inventoryAction; }