Пример #1
0
        public CenterProductDto Add(CenterProductDto centerProductDto)
        {
            var entity = centerProductFactory.CreateEntity(centerProductDto);

            unitOfWork.CenterProductRepository.Add(entity);
            unitOfWork.SaveChanges();
            var addedDto = centerProductFactory.CreateDto(entity);

            return(addedDto);
        }
Пример #2
0
        public CenterProductDto Update(CenterProductDto centerProductDto)
        {
            var entity = centerProductFactory.CreateEntity(centerProductDto);

            unitOfWork.CenterProductRepository.Update(entity);
            unitOfWork.SaveChanges();
            var dto = centerProductFactory.CreateDto(entity);

            return(dto);
        }
Пример #3
0
 public IActionResult Put(CenterProductDto centerProductDto)
 {
     centerProductService.Update(centerProductDto);
     return(Ok(centerProductDto));
 }
Пример #4
0
 public IActionResult Post(CenterProductDto centerProductDto)
 {
     centerProductService.Add(centerProductDto);
     return(Created("", centerProductDto));
 }