/// <summary>
 /// Deprecated Method for adding a new object to the ItemCategories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToItemCategories(ItemCategory itemCategory)
 {
     base.AddObject("ItemCategories", itemCategory);
 }
        public JsonResult CreateItemCategory(ItemCategoryModel 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 item category."
                });
            }

            try
            {
                JourListDMContainer dm = new JourListDMContainer();

                ItemCategory item = new ItemCategory();
                item.Description = model.Description;
                dm.AddToItemCategories(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 ItemCategory object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 public static ItemCategory CreateItemCategory(global::System.Int32 id, global::System.String description)
 {
     ItemCategory itemCategory = new ItemCategory();
     itemCategory.Id = id;
     itemCategory.Description = description;
     return itemCategory;
 }