public IHttpActionResult ChangePassword(CUSTOM_CHANGE_PASSWORD changePassword) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.DataNf, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } rs = repo.ChangePassword(changePassword.IdUser, changePassword.OldPassword, changePassword.NewPassword); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Delete, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Delete(int id) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Delete, new Exception(eFunc.fg.DataNf))); return(Content(HttpStatusCode.NotFound, resObj)); } rs = repo.Delete(id, "System", CurrentUser.GetCurrentDateTime()); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Delete, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Delete, new Exception(eFunc.fg.DFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Add(TOURIS_TV_SUB_CATEGORY subCategoryView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_SUB_CATEGORY subCategory = new TOURIS_TM_SUB_CATEGORY(); subCategory.CATEGORY_ID = subCategoryView.CATEGORY_ID; subCategory.VILLAGE_ID = subCategoryView.VILLAGE_ID; subCategory.SUB_CATEGORY_NAME = subCategoryView.SUB_CATEGORY_NAME; subCategory.SUB_CATEGORY_DESCRIPTION = subCategoryView.SUB_CATEGORY_DESCRIPTION; subCategory.START_TIME = subCategoryView.START_TIME; subCategory.END_TIME = subCategoryView.END_TIME; subCategory.PHOTO_PATH = subCategoryView.PHOTO_PATH; subCategory.ADDRESS = subCategoryView.ADDRESS; subCategory.LATITUDE = subCategoryView.LATITUDE; subCategory.LONGITUDE = subCategoryView.LONGITUDE; subCategory.CREATED_BY = subCategoryView.CREATED_BY; subCategory.CREATED_TIME = subCategoryView.CREATED_TIME; subCategory.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(subCategory); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Add(TOURIS_TV_SOSMED sosmedView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_SOSMED sosmed = new TOURIS_TM_SOSMED(); sosmed.TYPE = sosmedView.TYPE; sosmed.NAME = sosmedView.NAME; sosmed.DESCRIPTION = sosmedView.DESCRIPTION; sosmed.ICON = sosmedView.ICON; sosmed.URL = sosmedView.URL; sosmed.DATA_EMBED = sosmedView.DATA_EMBED; sosmed.HEIGHT = sosmedView.HEIGHT; sosmed.WIDTH = sosmedView.WIDTH; sosmed.DATA_WIDGET_ID = sosmedView.DATA_WIDGET_ID; sosmed.CREATED_BY = sosmedView.CREATED_BY; sosmed.CREATED_TIME = sosmedView.CREATED_TIME; sosmed.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(sosmed); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Add(TOURIS_TV_CATEGORY categoryView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_CATEGORY category = new TOURIS_TM_CATEGORY(); category.CATEGORY_CODE = categoryView.CATEGORY_CODE; category.CATEGORY_NAME = categoryView.CATEGORY_NAME; category.CATEGORY_DESCRIPTION = categoryView.CATEGORY_DESCRIPTION; category.URL = categoryView.URL; category.CLASS = categoryView.CLASS; category.PHOTO_PATH = categoryView.PHOTO_PATH; category.CREATED_BY = categoryView.CREATED_BY; category.CREATED_TIME = categoryView.CREATED_TIME; category.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(category); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Add(TOURIS_TV_SLIDESHOW slideshowView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_SLIDESHOW slideshow = new TOURIS_TM_SLIDESHOW(); slideshow.TITTLE = slideshowView.TITTLE; slideshow.CONTENT_DESCRIPTION = slideshowView.CONTENT_DESCRIPTION; slideshow.CLASS = slideshowView.CLASS; slideshow.PHOTO_PATH = slideshowView.PHOTO_PATH; slideshow.URL = slideshowView.URL; slideshow.CREATED_BY = slideshowView.CREATED_BY; slideshow.CREATED_TIME = slideshowView.CREATED_TIME; slideshow.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(slideshow); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Add(TOURIS_TV_DISTRICT districtView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_DISTRICT district = new TOURIS_TM_DISTRICT(); district.CITY_ID = districtView.CITY_ID; district.DISTRICT_CODE = districtView.DISTRICT_CODE; district.DISTRICT_NAME = districtView.DISTRICT_NAME; district.DISTRICT_DESCRIPTION = districtView.DISTRICT_DESCRIPTION; district.CREATED_BY = districtView.CREATED_BY; district.CREATED_TIME = districtView.CREATED_TIME; district.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(district); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Add(TOURIS_TV_PROVINCE provinceView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_PROVINCE province = new TOURIS_TM_PROVINCE(); province.COUNTRY_ID = provinceView.COUNTRY_ID; province.PROVINCE_CODE = provinceView.PROVINCE_CODE; province.PROVINCE_NAME = provinceView.PROVINCE_NAME; province.PROVINCE_DESCRIPTION = provinceView.PROVINCE_DESCRIPTION; province.CREATED_BY = provinceView.CREATED_BY; province.CREATED_TIME = provinceView.CREATED_TIME; province.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(province); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Add(TOURIS_TV_CONTACT_US contactUsView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_CONTACT_US contactUs = new TOURIS_TM_CONTACT_US(); contactUs.NAME_SENDER = contactUsView.NAME_SENDER; contactUs.EMAIL_SENDER = contactUsView.EMAIL_SENDER; contactUs.PHONE_SENDER = contactUsView.PHONE_SENDER; contactUs.DESCRIPTION = contactUsView.DESCRIPTION; contactUs.CREATED_BY = contactUsView.CREATED_BY; contactUs.CREATED_TIME = contactUsView.CREATED_TIME; contactUs.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(contactUs); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Edit(TOURIS_TV_DISTRICT ProvinceView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_DISTRICT district = new TOURIS_TM_DISTRICT(); district.ID = ProvinceView.ID; district.CITY_ID = ProvinceView.CITY_ID; district.DISTRICT_CODE = ProvinceView.DISTRICT_CODE; district.DISTRICT_NAME = ProvinceView.DISTRICT_NAME; district.DISTRICT_DESCRIPTION = ProvinceView.DISTRICT_DESCRIPTION; district.LAST_MODIFIED_TIME = ProvinceView.LAST_MODIFIED_TIME; district.LAST_MODIFIED_BY = ProvinceView.LAST_MODIFIED_BY; rs = repo.Edit(district); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, new Exception(eFunc.fg.EFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Add(TOURIS_TV_MENU menuView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_MENU menu = new TOURIS_TM_MENU(); menu.MENU_NAME = menuView.MENU_NAME; menu.MENU_DESCRIPTION = menuView.MENU_DESCRIPTION; menu.MENU_PARENT_ID = menuView.MENU_PARENT_ID; menu.CREATED_BY = menuView.CREATED_BY; menu.CREATED_TIME = menuView.CREATED_TIME; menu.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(menu); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Edit(TOURIS_TV_SUB_CATEGORY_PHOTO subCategoryPhotoView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_SUB_CATEGORY_PHOTO subCategoryPhoto = new TOURIS_TM_SUB_CATEGORY_PHOTO(); subCategoryPhoto.ID = subCategoryPhotoView.ID; subCategoryPhoto.SUB_CATEGORY_ID = subCategoryPhotoView.SUB_CATEGORY_ID; subCategoryPhoto.PHOTO_NAME = subCategoryPhotoView.PHOTO_NAME; subCategoryPhoto.PHOTO_DESCRIPTION = subCategoryPhotoView.PHOTO_DESCRIPTION; subCategoryPhoto.PHOTO_PATH = subCategoryPhotoView.PHOTO_PATH; subCategoryPhoto.LAST_MODIFIED_TIME = subCategoryPhotoView.LAST_MODIFIED_TIME; subCategoryPhoto.LAST_MODIFIED_BY = subCategoryPhotoView.LAST_MODIFIED_BY; rs = repo.Edit(subCategoryPhoto); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, new Exception(eFunc.fg.EFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Edit(TOURIS_TV_CITY cityView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_CITY city = new TOURIS_TM_CITY(); city.ID = cityView.ID; city.PROVINCE_ID = cityView.PROVINCE_ID; city.CITY_CODE = cityView.CITY_CODE; city.CITY_NAME = cityView.CITY_NAME; city.CITY_DESCRIPTION = cityView.CITY_DESCRIPTION; city.LAST_MODIFIED_TIME = cityView.LAST_MODIFIED_TIME; city.LAST_MODIFIED_BY = cityView.LAST_MODIFIED_BY; rs = repo.Edit(city); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, new Exception(eFunc.fg.EFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Login(CUSTOM_LOGIN login) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.DataNf, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_USER user = repo.Login(login.Email, login.Password); TOURIS_TV_USER userView = new TOURIS_TV_USER(); if (user != null) { userView.ID = user.ID; userView.USER_ID = user.USER_ID; userView.USER_MAIL = user.USER_MAIL; userView.USER_NAME = user.USER_NAME; userView.IS_SUPER_ADMIN = user.IS_SUPER_ADMIN; userView.LAST_LOGIN = user.LAST_LOGIN; userView.PASSWORD = user.PASSWORD; userView.PHOTO_PATH = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().PHOTO_PATH; userView.GENDER = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().GENDER; userView.BORN = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().BORN; userView.ADDRESS = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().ADDRESS; userView.DESCRIPTION = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().DESCRIPTION; userView.JOB = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().JOB; userView.COMPANY = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().COMPANY; userView.HOBBY = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().HOBBY; userView.CREATED_BY = user.CREATED_BY; userView.CREATED_TIME = user.CREATED_TIME; userView.LAST_MODIFIED_BY = user.LAST_MODIFIED_BY; userView.LAST_MODIFIED_TIME = user.LAST_MODIFIED_TIME; if (user.TOURIS_TM_USER_PROFILE != null) { TOURIS_TV_USER_PROFILE userProfileView = new TOURIS_TV_USER_PROFILE(); userProfileView.ID = user.ID; userProfileView.USER_ID_ID = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().USER_ID_ID; userProfileView.PHOTO_PATH = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().PHOTO_PATH; userProfileView.GENDER = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().GENDER; userProfileView.BORN = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().BORN; userProfileView.ADDRESS = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().ADDRESS; userProfileView.DESCRIPTION = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().DESCRIPTION; userProfileView.JOB = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().JOB; userProfileView.COMPANY = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().COMPANY; userProfileView.HOBBY = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().HOBBY; userProfileView.CREATED_BY = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().CREATED_BY; userProfileView.CREATED_TIME = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().CREATED_TIME; userProfileView.LAST_MODIFIED_BY = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().LAST_MODIFIED_BY; userProfileView.LAST_MODIFIED_TIME = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().LAST_MODIFIED_TIME; if (user.TOURIS_TM_USER_PROFILE.FirstOrDefault().TOURIS_TM_USER_PROFILE_SOSMED.Count > 0) { foreach (var itemSosmed in user.TOURIS_TM_USER_PROFILE.FirstOrDefault().TOURIS_TM_USER_PROFILE_SOSMED) { TOURIS_TV_USER_PROFILE_SOSMED userProfileSosmedView = new TOURIS_TV_USER_PROFILE_SOSMED(); userProfileSosmedView.ID = user.ID; userProfileSosmedView.USER_PROFILE_ID = itemSosmed.USER_PROFILE_ID; userProfileSosmedView.SOSMED_NAME = itemSosmed.SOSMED_NAME; userProfileSosmedView.SOSMED_PATH = itemSosmed.SOSMED_PATH; userProfileSosmedView.CREATED_BY = itemSosmed.CREATED_BY; userProfileSosmedView.CREATED_TIME = itemSosmed.CREATED_TIME; userProfileSosmedView.LAST_MODIFIED_BY = itemSosmed.LAST_MODIFIED_BY; userProfileSosmedView.LAST_MODIFIED_TIME = itemSosmed.LAST_MODIFIED_TIME; userProfileView.TOURIS_TV_USER_PROFILE_SOSMED.Add(userProfileSosmedView); } } userView.TOURIS_TV_USER_PROFILE.Add(userProfileView); } rs.SetSuccessStatus(); } resObj = JObject.FromObject(res.ResGetDataTable(new object[] { userView }, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
public IHttpActionResult Edit(TOURIS_TV_USER userView) { ApiResData res = new ApiResData(); TOURIS_TM_USER user = new TOURIS_TM_USER(); TOURIS_TM_USER_PROFILE userProfile = new TOURIS_TM_USER_PROFILE(); List <TOURIS_TM_USER_PROFILE_SOSMED> userProfileSosmeds = new List <TOURIS_TM_USER_PROFILE_SOSMED>(); try { //if (!ModelState.IsValid) //{ // rs.SetErrorStatus(eFunc.fg.SFailed); // resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, new Exception(eFunc.fg.DataIsntValid))); // return Content(HttpStatusCode.NotFound, resObj); //} if (userView != null) { user.ID = userView.ID; user.USER_ID = userView.USER_ID; user.USER_MAIL = userView.USER_MAIL; user.USER_NAME = userView.USER_NAME; user.IS_SUPER_ADMIN = userView.IS_SUPER_ADMIN; user.LAST_MODIFIED_BY = userView.LAST_MODIFIED_BY; user.LAST_MODIFIED_TIME = userView.LAST_MODIFIED_TIME; if (userView.TOURIS_TV_USER_PROFILE != null) { userProfile.USER_ID_ID = userView.ID; if (userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().PHOTO_PATH != null) { userProfile.PHOTO_PATH = userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().PHOTO_PATH; } userProfile.GENDER = userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().GENDER; userProfile.BORN = userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().BORN; userProfile.ADDRESS = userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().ADDRESS; userProfile.DESCRIPTION = userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().DESCRIPTION; userProfile.JOB = userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().JOB; userProfile.COMPANY = userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().COMPANY; userProfile.HOBBY = userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().HOBBY; userProfile.LAST_MODIFIED_BY = userView.LAST_MODIFIED_BY; userProfile.LAST_MODIFIED_TIME = userView.LAST_MODIFIED_TIME; if (userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().TOURIS_TV_USER_PROFILE_SOSMED.Count > 0) { foreach (var itemSosmed in userView.TOURIS_TV_USER_PROFILE.FirstOrDefault().TOURIS_TV_USER_PROFILE_SOSMED) { TOURIS_TM_USER_PROFILE_SOSMED userProfileSosmed = new TOURIS_TM_USER_PROFILE_SOSMED(); userProfileSosmed.ID = user.ID; userProfileSosmed.USER_PROFILE_ID = itemSosmed.USER_PROFILE_ID; userProfileSosmed.SOSMED_NAME = itemSosmed.SOSMED_NAME; userProfileSosmed.SOSMED_PATH = itemSosmed.SOSMED_PATH; userProfileSosmed.CREATED_BY = itemSosmed.CREATED_BY; userProfileSosmed.CREATED_TIME = itemSosmed.CREATED_TIME; userProfileSosmed.LAST_MODIFIED_BY = itemSosmed.LAST_MODIFIED_BY; userProfileSosmed.LAST_MODIFIED_TIME = itemSosmed.LAST_MODIFIED_TIME; userProfileSosmeds.Add(userProfileSosmed); } } } } rs = repo.Edit(user, userProfile, userProfileSosmeds); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Edit, new Exception(eFunc.fg.EFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }