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 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 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 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 RetrieveDataUser() { ApiGridResponse res = new ApiGridResponse(); try { List <TOURIS_TM_USER> users = new List <TOURIS_TM_USER>(); List <TOURIS_TV_USER> userViews = new List <TOURIS_TV_USER>(); using (TourismpediaEntities tourisdb = new TourismpediaEntities()) { users = tourisdb.TOURIS_TM_USER.ToList(); } if (users.Count > 0) { foreach (var item in users) { TOURIS_TV_USER userView = new TOURIS_TV_USER(); userView.USER_NAME = item.USER_NAME; userView.USER_MAIL = item.USER_MAIL; userViews.Add(userView); } } res = ResGetDataTable(new object[] { userViews }, null); } catch (Exception ex) { res = ResGetDataTable(null, ex); } return(res); }
public ApiGridResponse RetrieveDataCountryList() { ResultStatus rs = new ResultStatus(); ApiGridResponse res = new ApiGridResponse(); try { List <TOURIS_TM_COUNTRY> countries = new List <TOURIS_TM_COUNTRY>(); List <TOURIS_TV_COUNTRY> countryViews = new List <TOURIS_TV_COUNTRY>(); using (TourismpediaEntities tourisdb = new TourismpediaEntities()) { countries = tourisdb.TOURIS_TM_COUNTRY.ToList(); } if (countries.Count > 0) { foreach (var item in countries) { TOURIS_TV_COUNTRY countryView = new TOURIS_TV_COUNTRY(); countryView.ID = item.ID; countryView.COUNTRY_CODE = item.COUNTRY_CODE; countryView.COUNTRY_NAME = item.COUNTRY_NAME; countryView.COUNTRY_DESCRIPTION = item.COUNTRY_DESCRIPTION; countryView.CREATED_BY = item.CREATED_BY; countryView.CREATED_TIME = item.CREATED_TIME; countryView.LAST_MODIFIED_BY = item.LAST_MODIFIED_BY; countryView.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME; countryViews.Add(countryView); } rs.SetSuccessStatus(); } res = ResGetDataTable(new object[] { countryViews }, null); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); res = ResGetDataTable(new object[] { rs }, ex); } return(res); }
public ApiGridResponse TestGetDataTable(InputForm fm) { ApiGridResponse res = new ApiGridResponse(); try { InputForm inf = new InputForm() { nama = fm.nama, alamat = fm.alamat, notelp = fm.notelp }; res = ResGetDataTable(new object[] { inf }, null); } catch (Exception ex) { res = ResGetDataTable(null, ex); } return(res); }
public ApiGridResponse Get2() { //TOURIS_TM_MENU tm = new TOURIS_TM_MENU(); //ApiResData res = new ApiResData(); //List<TOURIS_TM_MENU> isGet = repo.GetDtMenu(); ApiGridResponse _objResponseModel = new ApiGridResponse(); ApiStatus st = new ApiStatus(); List <Student> students = new List <Student>(); students.Add(new Student { ID = 101, Name = "Seam", Email = "*****@*****.**", Address = "Dhaka,Bangladesh" }); students.Add(new Student { ID = 102, Name = "Mitila", Email = "*****@*****.**", Address = "Dhaka,Bangladesh" }); students.Add(new Student { ID = 104, Name = "Popy", Email = "*****@*****.**", Address = "Dhaka,Bangladesh" }); _objResponseModel.Header.Status = st.res.Success; _objResponseModel.Header.Message = st.res.BindData; _objResponseModel.Body.Data = students; return(_objResponseModel); }
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); }