public void Execute()
        {
            //getting the unit of work like this is not ideal. Think of ways that we could solve this.
            var unitOfWork = Environment.GetUnitOfWork();
            var clientRepository = unitOfWork.GetRepository<Domain.Models.Client>();

            try
            {
                var client = new Domain.Models.Client(ClientName, ClientSurname, PhoneNumber);
                clientRepository.Add(client);
                unitOfWork.Commit();

                Environment.Logger.Verbose("Registered client {0} {1} with Id {2}", client.Name, client.Surname, client.Id);
            }
            catch
            {
                unitOfWork.Rollback();
                throw;
            }
        }
 public static EntityModels.Client ToEntity(this Domain.Models.Client model)
 {
     return(model == null ? null : Mapper.Map <EntityModels.Client>(model));
 }
 public static void ToEntity(this Domain.Models.Client model, EntityModels.Client entity)
 {
     Mapper.Map(model, entity);
 }
Beispiel #4
0
 public UpdateClientCommand(Domain.Models.Client client, int id)
 {
     this.Client = client;
     Id          = id;
 }