Exemple #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();
        }
Exemple #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);
        }
        public string AddSupplier(SUPPLIER Supplier)
        {
            string Result = "Success";

            try
            {
                poDb.SUPPLIERs.Add(Supplier);
                poDb.SaveChanges();
            }
            catch (Exception ex)
            {
                Result = ex.Message;
            }
            return(Result);
        }
        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);
        }