/// <summary> /// Tạo mời một CatEthnicGroup /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult Create([Bind] CatEthnicGroupModel model) { var service = new RestServiceClient <CatEthnicGroupModel>(UserLogin); service.SetCookies(this.Request.Cookies, _hrm_Hr_Service); var result = service.Put(_hrm_Hr_Service, "api/CatEthnicGroup/", model); return(Json(result)); }
public CatEthnicGroupModel Post([Bind] CatEthnicGroupModel model) { #region Validate string message = string.Empty; var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <CatEthnicGroupModel>(model, "Cat_EthnicGroup", ref message); if (!checkValidate) { model.ActionStatus = message; return(model); } #endregion ActionService service = new ActionService(UserLogin); return(service.UpdateOrCreate <Cat_EthnicGroupEntity, CatEthnicGroupModel>(model)); }
/// <summary> /// [Tin.Nguyen] - Lấy dữ liệu Dân Tộc(Cat_EthnicGroup) theo Id /// </summary> /// <param name="id"></param> /// <returns></returns> public CatEthnicGroupModel GetById(Guid id) { string status = string.Empty; var model = new CatEthnicGroupModel(); ActionService service = new ActionService(UserLogin); var entity = service.GetByIdUseStore <Cat_EthnicGroupEntity>(id, ConstantSql.hrm_cat_sp_get_EthnicGroupById, ref status); if (entity != null) { model = entity.CopyData <CatEthnicGroupModel>(); } model.ActionStatus = status; return(model); }
public ActionResult Edit([DataSourceRequest] DataSourceRequest request, CatEthnicGroupModel CatEthnicGroup) { CatEthnicGroupModel catEthnicGroupmodel = null; if (ModelState.IsValid) { var client = CreateWebClient(); string url = _hrm_Hr_Service + "CatEthnicGroupDataSource/UpdateCatEthnicGroup"; string method = "POST"; var json = new JavaScriptSerializer().Serialize(CatEthnicGroup); client.Headers.Add("Content-Type", "application/json"); var response = client.UploadString(url, method, json); catEthnicGroupmodel = JsonConvert.DeserializeObject <CatEthnicGroupModel>(response); } return(View()); }
public ActionResult Edit(Guid id) { CatEthnicGroupModel catEthnicGroupmodel = new CatEthnicGroupModel(); catEthnicGroupmodel.ID = id; var client = CreateWebClient(); string url = _hrm_Hr_Service + "CatEthnicGroupDataSource/GetCatEthnicGroupById"; string method = "POST"; var json = new JavaScriptSerializer().Serialize(catEthnicGroupmodel); client.Headers.Add("Content-Type", "application/json"); var response = client.UploadString(url, method, json); CatEthnicGroupModel catEthnicGroup = new CatEthnicGroupModel(); catEthnicGroup = JsonConvert.DeserializeObject <CatEthnicGroupModel>(response); return(View(catEthnicGroup)); }
public ActionResult CreateCatEthnicGroup(CatEthnicGroupModel CatEthnicGroup) { CatEthnicGroupModel catEthnicGroupmodel = null; if (ModelState.IsValid) { var client = CreateWebClient(); string url = _hrm_Hr_Service + "CatEthnicGroupDataSource/AddCatEthnicGroup"; string method = "POST"; var json = new JavaScriptSerializer().Serialize(CatEthnicGroup); client.Headers.Add("Content-Type", "application/json"); var response = client.UploadString(url, method, json); catEthnicGroupmodel = JsonConvert.DeserializeObject <CatEthnicGroupModel>(response); //ModelState.AddModelError("Error", "Success"); ViewBag.MsgInsert = "Insert success"; } return(View()); }