/// <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 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();
        }
 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);
        }