Пример #1
0
 public ClientModel SaveClient(ClientModel model)
 {
     //unitOfWork.StartTransaction();
     ClientRepository repo = new ClientRepository(unitOfWork);
     Client client = new Client();
     AutoMapper.Mapper.Map(model, client);
     repo.Insert(client);
     //unitOfWork.Commit();
     AutoMapper.Mapper.Map(client, model);
     return model;
 }
Пример #2
0
 public ClientModel GetClientById(string clientId)
 {
     //unitOfWork.StartTransaction();
     ClientRepository repo = new ClientRepository(unitOfWork);
     ClientModel clientModel = new ClientModel();
     Client client = new Client();
     AutoMapper.Mapper.Map(clientModel, client);
      client = repo.GetAll().Where(x => x.ClientId == clientId).FirstOrDefault();
     //unitOfWork.Commit();
     AutoMapper.Mapper.Map(client, clientModel);
     return clientModel;
 }
Пример #3
0
 public ClientModel UpadteClient(ClientModel model)
 {
     //unitOfWork.StartTransaction();
     ClientRepository repo = new ClientRepository(unitOfWork);
     Client client = new Client();
     client = repo.GetAll().Where(x => x.ClientId == model.ClientId).FirstOrDefault();
     AutoMapper.Mapper.Map(model, client);
     repo.Update(client);
     //unitOfWork.Commit();
     AutoMapper.Mapper.Map(client, model);
     return model;
 }