示例#1
0
 public void Handle(BookingMade @event)
 {
     //Don't add this if it is relevant to this system - this will already have been done locally.
     if (@event.BookingTypeId != Constants.SalesAppointmentBookingTypeId)
     {
         var consultant = _consultantRepository.GetById(@event.EmployeeId);
         TimeAllocation.Book(consultant, @event.Id, @event.Start, @event.End);
     }
 }
 public void Handle(EmployeeRegistered @event)
 {
     if (@event.DepartmentId != Constants.SalesDepartmentId)
     {
         Consultant.Add(@event.Id, @event.Forename, @event.Surname, @event.Joined);
     }
     else
     {
         var employee = _consultantRepository.GetById(@event.Id);
         employee.ServerValidate();
     }
 }
示例#3
0
        public async Task <ConsultantResponse> DeleteAsync(Consultant consultant)
        {
            if (_consultantRepository.GetById(consultant.ID) == null)
            {
                return(new ConsultantResponse("Object With Specific ID Was Null"));
            }

            try
            {
                _consultantRepository.Delete(consultant);
                await _unitOfWork.CompleteAsync();

                return(new ConsultantResponse(consultant));
            }
            catch (Exception ex)
            {
                // Do some logging stuff
                return(new ConsultantResponse($"An error occurred when deleting the Consultant: {ex.Message}"));
            }
        }