public bool Put(int id, [FromBody] ItemMasterEntity cityMasterEntity)
 {
     if (id > 0)
     {
         return(_cityMasterServices.UpdateItem(id, cityMasterEntity));
     }
     return(false);
 }
Beispiel #2
0
        public void SubmitForm(ItemMasterViewModel entity, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                //entity.Modify(keyValue);
                //service.Update(entity);
            }
            else
            {
                ItemMasterEntity itemMasterEntity = new ItemMasterEntity()
                {
                    F_Code     = entity.F_Code,
                    F_Name     = entity.F_Name,
                    F_Desc     = entity.F_Desc,
                    F_IsEnable = entity.F_IsEnable,
                    F_OwerOrg  = entity.F_OwerOrg,
                    F_POPrice  = entity.F_POPrice
                };
                itemMasterEntity.F_DeleteMark = false;
                itemMasterEntity.Create();

                int i = 0;
                List <ItemMasterPicEntity> listPic = new List <ItemMasterPicEntity>();
                foreach (var item in entity.listPic)
                {
                    ItemMasterPicEntity picEntity = new ItemMasterPicEntity()
                    {
                        F_IsMainPic  = i == 0,
                        F_ItemMaster = itemMasterEntity.F_Id,
                        F_Path       = item
                    };
                    picEntity.F_DeleteMark = false;
                    picEntity.Create();
                    listPic.Add(picEntity);
                    i++;
                }
                service.SubmitForm(itemMasterEntity, listPic, keyValue);
                //foreach (var item in entity.listAttrInfo)
                //{
                //    ItemMasterPicEntity picEntity = new ItemMasterPicEntity()
                //    {
                //        F_IsMainPic = i == 0,
                //        F_ItemMaster = itemMasterEntity.F_ID,
                //        F_Path = item
                //    };
                //    picEntity.Create();
                //    i++;
                //}

                //entity.Create();
                //service.Insert(entity);
            }
        }
 public int Post([FromBody] ItemMasterEntity cityMasterEntity)
 {
     return(_cityMasterServices.CreateItem(cityMasterEntity));
 }