public ActionResult Create([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.TOURIS_TM_COUNTRY.Add(tOURIS_TM_COUNTRY); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tOURIS_TM_COUNTRY)); }
public ApiGridResponse InsertDataCountry(TOURIS_TV_COUNTRY countryView) { ApiGridResponse res = new ApiGridResponse(); ResultStatus rs = new ResultStatus(); try { TOURIS_TM_COUNTRY country = new TOURIS_TM_COUNTRY(); using (TourismpediaEntities tourisdb = new TourismpediaEntities()) { country.COUNTRY_CODE = countryView.COUNTRY_CODE; country.COUNTRY_NAME = countryView.COUNTRY_NAME; country.COUNTRY_DESCRIPTION = countryView.COUNTRY_DESCRIPTION; country.CREATED_BY = countryView.CREATED_BY; country.CREATED_TIME = countryView.CREATED_TIME; tourisdb.TOURIS_TM_COUNTRY.Add(country); 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); }
public ApiGridResponse DeleteDataCountry(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); tourisdb.TOURIS_TM_COUNTRY.Remove(country); 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); }
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); }
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 ApiGridResponse InsertDataUser(TOURIS_TV_USER userView) { ApiGridResponse res = new ApiGridResponse(); ResultStatus rs = new ResultStatus(); try { TOURIS_TM_USER user = new TOURIS_TM_USER(); using (TourismpediaEntities tourisdb = new TourismpediaEntities()) { user.USER_NAME = userView.USER_NAME; user.USER_MAIL = userView.USER_MAIL; user.CREATED_BY = userView.CREATED_BY; user.CREATED_TIME = userView.CREATED_TIME; tourisdb.TOURIS_TM_USER.Add(user); tourisdb.SaveChanges(); rs.SetSuccessStatus(); } res = ResGetDataTable(new object[] { rs }, null); } catch (Exception ex) { res = ResGetDataTable(null, ex); } return(res); }
public ApiGridResponse DeleteDataUser(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); tourisdb.TOURIS_TM_USER.Remove(user); tourisdb.SaveChanges(); rs.SetSuccessStatus(); } res = ResGetDataTable(new object[] { rs }, null); } catch (Exception ex) { res = ResGetDataTable(null, ex); } return(res); }