Beispiel #1
0
        public Task <EmpLanguageModel> GetAsync(int id)
        {
            var dal = _empLanguageRepository.Get(id);

            if (dal == null)
            {
                return(Task.FromResult <EmpLanguageModel>(null));
            }
            else
            {
                EmpLanguageModel model = AutoMapperGenericHelper <EmpLanguage, EmpLanguageModel> .Convert(dal);

                return(Task.FromResult(model));
            }
        }
        public IHttpActionResult Put(EmpLanguageModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                _empLanguageService.UpdateAsync(model);
                return(Ok());
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Beispiel #3
0
        public Task UpdateAsync(EmpLanguageModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("EmpLanguageModel ArgumentNullException Insert Async");
            }

            EmpLanguage dto = AutoMapperGenericHelper <EmpLanguageModel, EmpLanguage> .Convert(model);

            EmpEmployeePk pk1 = _empEmployeePkRepository.Get((int)model.EmployeePkId);

            dto.EmpEmployeePk = pk1;
            if (pk1 == null)
            {
                throw new ArgumentNullException("EmployeePkId ArgumentNullException Insert Async");
            }


            _empLanguageRepository.Update(dto);

            return(Task.FromResult <object>(null));
        }