Exemple #1
0
        public async Task <IHttpActionResult> UpdateAsync(int id, InstitutionDto institution)
        {
            var institutionInDb = await _repository.GetAsync(id);

            if (institutionInDb == null)
            {
                return(NotFound());
            }

            _repository.Add(institution.Map <Institution>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
        public void Handle(AddInstitutionCommand message)
        {
            var institution = new Domain.Institution.Institution(
                message.Name,
                message.Email,
                message.Phone,
                _addressRepository.GetById(message.AddressId));

            _institutionRepository.Add(institution);

            if (!Commit())
            {
                return;
            }

            _bus.RaiseEvent(new AddInstitutionEvent(
                                message.Name,
                                message.Email,
                                message.Phone,
                                message.AddressId));
        }
Exemple #3
0
 public void CreateInstitution(InstitutionModel model)
 {
     _institutionRepository.Add(model.ToEntity());
 }
 public Institution Add(Institution institution)
 {
     return(_institutionRepository.Add(institution));
 }