Exemple #1
0
        public ApiGridResponse EditDataCountry(TOURIS_TV_COUNTRY countryView)
        {
            ApiGridResponse res = new ApiGridResponse();
            ResultStatus    rs  = new ResultStatus();

            try
            {
                using (TourismpediaEntities tourisdb = new TourismpediaEntities())
                {
                    TOURIS_TM_COUNTRY country = tourisdb.TOURIS_TM_COUNTRY.Find(countryView.ID);
                    country.COUNTRY_CODE        = countryView.COUNTRY_CODE;
                    country.COUNTRY_NAME        = countryView.COUNTRY_NAME;
                    country.COUNTRY_DESCRIPTION = countryView.COUNTRY_DESCRIPTION;
                    country.LAST_MODIFIED_BY    = countryView.LAST_MODIFIED_BY;
                    country.LAST_MODIFIED_TIME  = countryView.LAST_MODIFIED_TIME;

                    tourisdb.Entry(country).State = EntityState.Modified;
                    tourisdb.SaveChanges();
                    rs.SetSuccessStatus();
                }
                res = ResGetDataTable(new object[] { rs }, null);
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                res = ResGetDataTable(new object[] { rs }, ex);
            }

            return(res);
        }
Exemple #2
0
        public ApiGridResponse EditDataUser(TOURIS_TV_USER userView)
        {
            ApiGridResponse res = new ApiGridResponse();
            ResultStatus    rs  = new ResultStatus();

            try
            {
                using (TourismpediaEntities tourisdb = new TourismpediaEntities())
                {
                    TOURIS_TM_USER user = tourisdb.TOURIS_TM_USER.Find(userView.ID);
                    user.USER_NAME          = userView.USER_NAME;
                    user.USER_MAIL          = userView.USER_MAIL;
                    user.LAST_MODIFIED_BY   = userView.LAST_MODIFIED_BY;
                    user.LAST_MODIFIED_TIME = userView.LAST_MODIFIED_TIME;

                    tourisdb.Entry(user).State = EntityState.Modified;
                    tourisdb.SaveChanges();
                    rs.SetSuccessStatus();
                }
                res = ResGetDataTable(new object[] { rs }, null);
            }
            catch (Exception ex)
            {
                res = ResGetDataTable(null, ex);
            }

            return(res);
        }
 public ActionResult Edit([Bind(Include = "ID,COUNTRY_NAME,COUNTRY_CODE,COUNTRY_DESCRIPTION,CREATED_TIME,CREATED_BY,LAST_MODIFIED_TIME,LAST_MODIFIED_BY,ROW_STATUS")] TOURIS_TM_COUNTRY tOURIS_TM_COUNTRY)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tOURIS_TM_COUNTRY).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tOURIS_TM_COUNTRY));
 }