public ActionResult AddJobPartDictionaryValue(JobPartDictionaryValueViewModel model)
        {
            var result = new { Success = "true", Message = "Success" };

            if (ModelState.IsValid)
            {
                try
                {
                    if (model.JobPartDictionaryId > 0)
                    {
                        var jobPartValue = Mapper.Map <JobPartDictionaryValue>(model);

                        _jobPartDictionaryService.CreateDictionaryValue(jobPartValue);
                    }
                    else
                    {
                        JobPartDictionary dictionary = new JobPartDictionary()
                        {
                            UserCompanyId = model.UserCompanyId,
                            CreatedDate   = DateTime.Now,
                            UpdatedDate   = DateTime.Now
                        };

                        int dictionaryId = _jobPartDictionaryService.Create(dictionary);

                        var positionValue = Mapper.Map <JobPartDictionaryValue>(model);
                        positionValue.JobPartDictionaryId = dictionaryId;

                        _jobPartDictionaryService.CreateDictionaryValue(positionValue);
                    }
                }
                catch (Exception e)
                {
                    logger.Error(e, e.Message);
                    result = new { Success = "false", Message = WebResources.ErrorMessage };
                }
            }
            else
            {
                var error = ModelState.Values.SelectMany(v => v.Errors).FirstOrDefault().ErrorMessage;

                result = new { Success = "false", Message = error };
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
 public void Update(JobPartDictionary entity)
 {
     _jobPartDictionaryRepository.Update(entity);
 }
 public void Delete(JobPartDictionary entity)
 {
     entity.IsDeleted = true;
     _jobPartDictionaryRepository.Update(entity);
 }
        public int Create(JobPartDictionary entity)
        {
            _jobPartDictionaryRepository.Insert(entity);

            return(entity.Id);
        }