Esempio n. 1
0
        /// <summary>
        /// Tạo mời một CatOrgStructureType
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult Create([Bind] CatOrgStructureTypeModel model)
        {
            var service = new RestServiceClient <CatOrgStructureTypeModel>(UserLogin);

            service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
            var result = service.Put(_hrm_Hr_Service, "api/CatOrgStructureType/", model);

            return(Json(result));
        }
        /// <summary>
        /// [Son.Vo] - Lấy dữ liệu OrgStructureType  (Cat_OrgStructureType) theo Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public CatOrgStructureTypeModel GetById(Guid id)
        {
            string        status  = string.Empty;
            var           model   = new CatOrgStructureTypeModel();
            ActionService service = new ActionService(UserLogin);
            var           entity  = service.GetByIdUseStore <Cat_OrgStructureTypeEntity>(id, ConstantSql.hrm_cat_sp_get_OrgStructureTypeById, ref status);

            if (entity != null)
            {
                model = entity.CopyData <CatOrgStructureTypeModel>();
            }
            model.ActionStatus = status;
            return(model);
        }
        public CatOrgStructureTypeModel Post([Bind] CatOrgStructureTypeModel model)
        {
            #region Validate

            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <CatOrgStructureTypeModel>(model, "Cat_OrgStructureType", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }

            #endregion
            ActionService service = new ActionService(UserLogin);
            return(service.UpdateOrCreate <Cat_OrgStructureTypeEntity, CatOrgStructureTypeModel>(model));
        }