public CorporateReadDto Create(CorporateCreateDto dto)
        {
            var corporate = _mapper.Map <Corporate>(dto);

            var owner = _context.Users.FirstOrDefault(e => e.Id == dto.OwnerId);

            if (owner == null)
            {
                throw new BusinessException("Owner does not exist", 400);
            }

            _context.Corporators.Add(corporate);

            _context.SaveChanges();

            _logger.Log("Corporate created!");

            return(_mapper.Map <CorporateReadDto>(corporate));
        }
        public CorporateReadDto Update(int id, CorporateCreateDto dto)
        {
            var corporate = _context.Corporators.FirstOrDefault(e => e.Id == id);

            if (corporate == null)
            {
                throw new BusinessException("Admin does not exist");
            }

            corporate.CreatedAt      = dto.CreatedAt;
            corporate.Pib            = dto.Pib;
            corporate.CompanyName    = dto.CompanyName;
            corporate.CompanyCity    = dto.CompanyCity;
            corporate.CompanyAddress = dto.CompanyAddress;
            corporate.CompanyEmail   = dto.CompanyEmail;
            corporate.CompanyMobile  = dto.CompanyMobile;
            corporate.OwnerId        = dto.OwnerId;

            _context.SaveChanges();

            return(_mapper.Map <CorporateReadDto>(corporate));
        }
        public ActionResult PutCorporate(int id, CorporateCreateDto dto)
        {
            var entity = _repository.Update(id, dto);

            return(Ok(entity));
        }
        public ActionResult PostCorporate([FromBody] CorporateCreateDto dto)
        {
            var entity = _repository.Create(dto);

            return(Ok(entity));
        }