Ejemplo n.º 1
0
        // GET: /Inventory/Group/CreateGroup

        public JsonResult CreateGroup(InvGroup aObj)
        {
            var data = _aManager.CreateGroup(aObj);

            // var data = _aManager.CreatAssetCategory(aObj);

            return(Json(new { success = data.Status, data }, JsonRequestBehavior.AllowGet));
            // return null;
        }
 public ResponseModel CreateGroup(InvGroup aObj)
 {
     try
     {
         if (aObj.GroupId == 0)
         {
             aObj.CreatedDate = DateTime.Now;
             _aRepository.Insert(aObj);
             _aRepository.Save();
             return(_aModel.Respons(true, "New Group Successfully Saved"));
         }
         else
         {
             _aRepository.Update(aObj);
             _aRepository.Save();
             return(_aModel.Respons(true, "Group Successfully Updated"));
         }
     }
     catch (Exception)
     {
         return(_aModel.Respons(false, "Sorry! Some Error Happned."));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Inventory Item Groups
        /// </summary>
        /// <returns><c>Bag</c> of Inventory Groups</returns>
        internal static Bag <InvGroup> Groups()
        {
            var list = new IndexedList <InvGroup>();

            foreach (invGroups group in Context.invGroups)
            {
                var item = new InvGroup
                {
                    ID        = group.groupID,
                    Name      = group.groupName,
                    Published = group.published.Value
                };

                if (group.categoryID.HasValue)
                {
                    item.CategoryID = group.categoryID.Value;
                }

                list.Items.Add(item);
            }

            return(new Bag <InvGroup>(list));
        }