Example #1
0
 public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Sal_SalaryDepartmentModel Contract)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Sal_SalaryDepartmentModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Sal_SalaryDepartment/", Contract);
         ViewBag.MsgUpdate = "Update success";
     }
     return(View());
 }
Example #2
0
 public ActionResult Create(Sal_SalaryDepartmentModel model)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Sal_SalaryDepartmentModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Sal_SalaryDepartment/", model);
         ViewBag.MsgInsert = "Insert success";
     }
     return(View());
 }
        public Sal_SalaryDepartmentModel GetById(Guid id)
        {
            string        status  = string.Empty;
            var           model   = new Sal_SalaryDepartmentModel();
            ActionService service = new ActionService(UserLogin);
            var           entity  = service.GetByIdUseStore <Sal_SalaryDepartmentEntity>(id, ConstantSql.hrm_sal_sp_get_SalDepartmentById, ref status);//note

            if (entity != null)
            {
                model = entity.CopyData <Sal_SalaryDepartmentModel>();
            }
            model.ActionStatus = status;
            return(model);
        }
        public Sal_SalaryDepartmentModel Post([Bind] Sal_SalaryDepartmentModel model)
        {
            #region Validate
            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Sal_SalaryDepartmentModel>(model, "Sal_SalaryDepartment", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion

            ActionService service = new ActionService(UserLogin);
            return(service.UpdateOrCreate <Sal_SalaryDepartmentEntity, Sal_SalaryDepartmentModel>(model));
        }