public async Task <IActionResult> AddClient(ClientInfoResource clientInfoResource)
        {
            var clientInfo = OffertMapper.MapClientInfoResourceToClientInfo(clientInfoResource);

            _offertRespository.AddClient(clientInfo);
            await _unitOfWork.UpdateDatabase();

            return(Ok());
        }
Beispiel #2
0
        public static ClientInfoResource MapClientInfoToClientInfoResource(ClientInfo clientInfo)
        {
            var clientInfoResource = new ClientInfoResource
            {
                Id            = clientInfo.Id,
                Name          = clientInfo.Name,
                Surname       = clientInfo.Surname,
                Phone         = clientInfo.Phone,
                Email         = clientInfo.Email,
                Preferences   = clientInfo.Preferences,
                IsAccepted    = clientInfo.IsAccepted,
                IsRejected    = clientInfo.IsRejected,
                IsRodoChecked = clientInfo.IsRodoChecked,
                OffertId      = clientInfo.OffertId
            };

            return(clientInfoResource);
        }
Beispiel #3
0
        public static ClientInfo MapClientInfoResourceToClientInfo(ClientInfoResource clientInfoResource)
        {
            var clientInfo = new ClientInfo
            {
                Id            = clientInfoResource.Id,
                Name          = clientInfoResource.Name,
                Surname       = clientInfoResource.Surname,
                Phone         = clientInfoResource.Phone,
                Email         = clientInfoResource.Email,
                Preferences   = clientInfoResource.Preferences,
                IsAccepted    = clientInfoResource.IsAccepted,
                IsRejected    = clientInfoResource.IsRejected,
                IsRodoChecked = clientInfoResource.IsRodoChecked,
                OffertId      = clientInfoResource.OffertId
            };

            return(clientInfo);
        }
        public async Task <IActionResult> CheckClient(ClientInfoResource clientInfoResource)
        {
            var clients = await _offertRespository.GetClientsInfo(clientInfoResource.OffertId);

            var client = clients.SingleOrDefault(c => c.Id == clientInfoResource.Id);

            var offert = await _offertRespository.GetOffert(clientInfoResource.OffertId);

            client.Offert = offert;

            if (clientInfoResource.IsAccepted)
            {
                client.IsAccepted = true;
                SendAcceptedEmail(client);
            }
            if (clientInfoResource.IsRejected)
            {
                client.IsRejected = true;
                SendRejectedEmail(client);
            }
            await _unitOfWork.UpdateDatabase();

            return(Ok());
        }