示例#1
0
        public List <ProfessionModel> SaveProfession(ProfessionModel model)
        {
            List <ProfessionModel> professionList = null;

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

                var profession = Mapper.Map <ProfessionModel, Master_StaffProfession>(model);
                if (profession.ID != Guid.Empty)
                {
                    profession.UpdatedBy   = model.CurrentUserID;
                    profession.UpdatedDate = DateTime.Now;
                    _professionRepository.UpdateProfession(profession);
                }
                else
                {
                    profession.ID          = Guid.NewGuid();
                    profession.CreatedBy   = model.CurrentUserID;
                    profession.CreatedDate = DateTime.Now;
                    _professionRepository.InsertProfession(profession);
                }
                professionList = GetAllProfessionList(model);
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "Profession", message);
                throw new Exception(ex.Message);
            }
            return(professionList);
        }