예제 #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));
        }
예제 #3
0
 public void CreateInstitution(InstitutionModel model)
 {
     _institutionRepository.Add(model.ToEntity());
 }
예제 #4
0
 public Institution Add(Institution institution)
 {
     return(_institutionRepository.Add(institution));
 }