Exemple #1
0
        public void UpdateItem(ItemModel item)
        {
            var dbItem = new ITEM
            {
                ITCODE = item.Code,
                ITDESC = item.Desc,
                ITRATE = item.Rate
            };

            dbContext.Entry(dbItem).State = EntityState.Modified;
            dbContext.SaveChanges();
        }
Exemple #2
0
        ///////////////

        public string CreateItem(ItemModel item)
        {
            var dbItem = new ITEM
            {
                ITCODE = item.Code,
                ITDESC = item.Desc,
                ITRATE = item.Rate
            };

            dbContext.ITEM.Add(dbItem);
            dbContext.SaveChanges();
            return(dbItem.ITCODE);
        }
        public string AddItem(ITEM Item)
        {
            string Result = "Success";

            try {
                poDb.ITEMs.Add(Item);
                poDb.SaveChanges();
            }
            catch (Exception ex) {
                Result = ex.Message;
            }
            return(Result);
        }
        public string UpdateItem(ITEM Item)
        {
            string Result = "Success";

            try
            {
                Purchase_Order_Processing_System.ITEM _ITEM = poDb.ITEMs.Where(x => x.ITCODE == Item.ITCODE).ToList().FirstOrDefault();
                _ITEM.ITDESC = Item.ITDESC;
                _ITEM.ITRATE = Item.ITRATE;
                poDb.SaveChanges();
            }
            catch (Exception ex)
            {
                Result = ex.Message;
            }
            return(Result);
        }