public async Task <IActionResult> PostSystemDefaults([FromBody] SystemDefaultDto companyDto)
        {
            var mappedModel = _mapper.Map <SystemDefault>(companyDto);
            await _unitOfWork.SystemDefault.Insert(mappedModel);

            await _unitOfWork.Save();

            return(CreatedAtRoute("GetSystemDefaultsById", new { id = mappedModel.CompanyId }, mappedModel));
        }
        public async Task <ActionResult> PutSystemDefault(int id, [FromBody] SystemDefaultDto companyDto)
        {
            try
            {
                var companyItem = await _unitOfWork.SystemDefault.Get(m => m.CompanyId == id);

                if (companyItem == null)
                {
                    return(NotFound());
                }
                var newCompanyType = _mapper.Map(companyDto, companyItem);
                _unitOfWork.SystemDefault.Update(newCompanyType);
                await _unitOfWork.Save();

                return(Ok(newCompanyType));
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
 public void UpdateAsync(SystemDefaultDto company)
 {
 }