コード例 #1
0
        public void UpdateSupplier(SupplierModel supplier)
        {
            var dbSupplier = new SUPPLIER
            {
                SUPLADDR = supplier.Address,
                SUPLNAME = supplier.Name,
                SUPLNO   = supplier.Id
            };

            dbContext.Entry(dbSupplier).State = EntityState.Modified;
            dbContext.SaveChanges();
        }
コード例 #2
0
        /// <summary>
        /// Add new supplier
        /// </summary>
        /// <param name="supplier"></param>
        /// <returns></returns>
        public string CreateSupplier(SupplierModel supplier)
        {
            var dbSupplier = new SUPPLIER
            {
                SUPLADDR = supplier.Address,
                SUPLNAME = supplier.Name,
                SUPLNO   = supplier.Id
            };

            dbContext.SUPPLIER.Add(dbSupplier);
            dbContext.SaveChanges();
            return(dbSupplier.SUPLNO);
        }
コード例 #3
0
        public string AddSupplier(SUPPLIER Supplier)
        {
            string Result = "Success";

            try
            {
                poDb.SUPPLIERs.Add(Supplier);
                poDb.SaveChanges();
            }
            catch (Exception ex)
            {
                Result = ex.Message;
            }
            return(Result);
        }
コード例 #4
0
        public string UpdateSupplier(SUPPLIER Supplier)
        {
            string Result = "Success";

            try
            {
                Purchase_Order_Processing_System.SUPPLIER _supplier = poDb.SUPPLIERs.Where(x => x.SUPLNO == Supplier.SUPLNO).ToList().FirstOrDefault();
                _supplier.SUPLADDR = Supplier.SUPLADDR;
                _supplier.SUPLNAME = Supplier.SUPLNAME;
                poDb.SaveChanges();
            }
            catch (Exception ex)
            {
                Result = ex.Message;
            }
            return(Result);
        }