Example #1
0
        //Add new record
        public static int AddRecord(etblPropertyCancellationPolicyMap eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblPropertyCancellationPolicyMap dbuser = (OneFineRate.tblPropertyCancellationPolicyMap)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblPropertyCancellationPolicyMap());
                    db.tblPropertyCancellationPolicyMaps.Add(dbuser);
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
Example #2
0
        //Update a record
        public static int UpdateRecord(etblPropertyCancellationPolicyMap eobj)
        {
            int retval = 0;

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