コード例 #1
0
        public async Task <ActionResult> EditClient([Bind(Include = "id,Surname,Name,PatronymicName,Phone,DateRegistration,Email,barcode,note")] ClientInfoView client, int IdClient, int idCar, int?SelectGroupClient)
        {
            if (ModelState.IsValid)
            {
                ClientInfoView clientInfo = Mapper.Map <ClientInfoView>(await _clientInfo.ClientInfoGetId(IdClient));
                clientInfo = client;

                ClientInfoBll clientInfoBll        = Mapper.Map <ClientInfoView, ClientInfoBll>(client);
                var           clientsOfCarWashView = Mapper.Map <IEnumerable <ClientsOfCarWashView> >(await _services.GetAll(idCar));

                foreach (var item in clientsOfCarWashView)
                {
                    item.IdClientsGroups = SelectGroupClient;

                    ClientsOfCarWashBll clients = Mapper.Map <ClientsOfCarWashView, ClientsOfCarWashBll>(item);
                    await _services.ClientCarUpdate(clients);
                }
                await _clientInfo.Update(clientInfoBll);

                return(RedirectToAction("Info", "ClientsOfCarWashViews", new RouteValueDictionary(new
                {
                    idClientInfo = idCar,
                    idClient = IdClient
                })));
            }

            ViewBag.Group = new SelectList(await _clientsGroups.GetClientsGroups(), "Id", "Name");
            return(View(client));
        }
コード例 #2
0
        public async Task <ActionResult> AddClient([Bind(Include = "Surname,Name,PatronymicName,Phone,DataFormatString,Email,note")] ClientInfoView client)
        {
            if (ModelState.IsValid)
            {
                ClientInfoBll clientInfo = Mapper.Map <ClientInfoView, ClientInfoBll>(client);
                await _clientInfo.Insert(clientInfo);

                return(RedirectToAction("ClientCarpetWashing"));
            }

            ViewBag.Group = new SelectList(await _clientsGroups.GetClientsGroups(), "Id", "Name");
            return(View(client));
        }
コード例 #3
0
        public async Task <ActionResult> EditClient([Bind(Include = "id,Surname,Name,PatronymicName,Phone,DateRegistration,Email,barcode,note")] ClientInfoView client, int idClient)
        {
            if (ModelState.IsValid)
            {
                ClientInfoView clientInfo = Mapper.Map <ClientInfoView>(await _clientInfo.ClientInfoGetId(idClient));
                clientInfo = client;

                ClientInfoBll clientInfoBll = Mapper.Map <ClientInfoView, ClientInfoBll>(client);

                await _clientInfo.Update(clientInfoBll);

                return(RedirectToAction("ClientDetails", "ClientInfo", new RouteValueDictionary(new
                {
                    id = idClient
                })));
            }

            return(View(client));
        }
コード例 #4
0
        public async Task <int> Distribute(ClientViewsBll client)

        {
            ClientsOfCarWashBll clientsOfCarWash = new ClientsOfCarWashBll();
            ClientInfoBll       clientInfoBll    = new ClientInfoBll();

            clientInfoBll.Name             = client.Name;
            clientInfoBll.Surname          = client.Surname;
            clientInfoBll.PatronymicName   = client.PatronymicName;
            clientInfoBll.Phone            = client.phone;
            clientInfoBll.DateRegistration = client.DateRegistration;
            clientInfoBll.Email            = client.Email;
            clientInfoBll.barcode          = client.barcode;
            clientInfoBll.note             = client.note;

            ClientInfo clientInfo = Mapper.Map <ClientInfoBll, ClientInfo>(clientInfoBll);

            _unitOfWork.ClientInfoUnitOfWork.Insert(clientInfo);
            await _unitOfWork.Save();

            clientsOfCarWash.IdBody          = client.IdBody;
            clientsOfCarWash.IdClientsGroups = client.IdClientsGroups;
            clientsOfCarWash.IdInfoClient    = clientInfo.Id;
            clientsOfCarWash.IdMark          = client.Idmark;
            clientsOfCarWash.IdModel         = client.Idmodel;
            clientsOfCarWash.IdBody          = client.IdBody;
            clientsOfCarWash.NumberCar       = client.NumberCar;
            clientsOfCarWash.discont         = client.discont;
            clientsOfCarWash.arxiv           = true;

            ClientsOfCarWash clientsOfCar = Mapper.Map <ClientsOfCarWashBll, ClientsOfCarWash>(clientsOfCarWash);

            _unitOfWork.ClientsOfCarWashUnitOfWork.Insert(clientsOfCar);
            await _unitOfWork.Save();

            return(clientsOfCar.id);
        }
コード例 #5
0
 ClientInfo TransformAnEntity(ClientInfoBll entity) =>
 Mapper.Map <ClientInfoBll, ClientInfo>(entity);
コード例 #6
0
 public async Task Update(ClientInfoBll elementToUpdate)
 {
     _unitOfWork.ClientInfoUnitOfWork.Update(TransformAnEntity(elementToUpdate));
     await _unitOfWork.Save();
 }
コード例 #7
0
 public async Task Insert(ClientInfoBll element)
 {
     _unitOfWork.ClientInfoUnitOfWork.Insert(TransformAnEntity(element));
     await _unitOfWork.Save();
 }
コード例 #8
0
 public async Task Delete(ClientInfoBll elementToDelete)
 {
     _unitOfWork.ClientInfoUnitOfWork.Delete(elementToDelete.Id);
     await _unitOfWork.Save();
 }