Ejemplo n.º 1
0
        public List <JobCategoryModel> SaveJobCategory(JobCategoryModel model)
        {
            List <JobCategoryModel> jobCategories = null;

            try
            {
                Utility.SetDynamicPropertyValue(model, model.CurrentCulture);

                var JobCategory = Mapper.Map <JobCategoryModel, Master_StaffJobCategory>(model);
                if (JobCategory.ID != Guid.Empty)
                {
                    JobCategory.UpdatedBy   = model.CurrentUserID;
                    JobCategory.UpdatedDate = DateTime.Now;
                    _jobCategoryRepository.UpdateJobCategory(JobCategory);
                }
                else
                {
                    JobCategory.ID          = Guid.NewGuid();
                    JobCategory.CreatedBy   = model.CurrentUserID;
                    JobCategory.CreatedDate = DateTime.Now;
                    _jobCategoryRepository.InsertJobCategory(JobCategory);
                }
                jobCategories = GetAllJobCategoryList(model);
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "JobCategory", message);
                throw new Exception(ex.Message);
            }
            return(jobCategories);
        }