Esempio n. 1
0
        //Add new record
        public static int AddRecord(eCountries eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblCountryM dbuser = (OneFineRate.tblCountryM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblCountryM());
                    db.tblCountryMs.Add(dbuser);
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
Esempio n. 2
0
        //Update a record
        public static int UpdateRecord(eCountries eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblCountryM obj = (OneFineRate.tblCountryM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblCountryM());
                    db.tblCountryMs.Attach(obj);
                    db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }