예제 #1
0
        public void AddFullVape(FullVapeDTO fullVapeDto)
        {
            FullVape fullVape = new FullVape
            {
                Name        = fullVapeDto.Name,
                Company     = fullVapeDto.Company,
                Accumulator = fullVapeDto.Accumulator,
                Brand       = fullVapeDto.Brand,
                Amount      = fullVapeDto.Amount,
                Contry      = fullVapeDto.Contry,
                Outturn     = fullVapeDto.Outturn,
                Price       = fullVapeDto.Price,
            };

            Database.FullVapes.Create(fullVape);
            Database.Save();
        }
예제 #2
0
        public void Add(ImageDTO imageDto)
        {
            FullVape fullVape = Database.FullVapes.Get(imageDto.FullVapeId);

            // валидация
            if (fullVape == null)
            {
                throw new ValidationException("FullVape не найден", "");
            }
            Image image = new Image
            {
                Data       = imageDto.Data,
                MimeType   = imageDto.MimeType,
                FullVapeId = fullVape.Id,
            };

            Database.Images.Create(image);
            Database.Save();
        }
예제 #3
0
        public void MakeOrderFullVape(OrderDTO orderDto)
        {
            FullVape fullVape = Database.FullVapes.Get(orderDto.FullVapeId);

            // валидация
            if (fullVape == null)
            {
                throw new ValidationException("FullVape не найден", "");
            }
            decimal sum   = fullVape.Price;
            Order   order = new Order
            {
                Date        = DateTime.Now,
                Address     = orderDto.Address,
                FullVapeId  = fullVape.Id,
                Sum         = sum,
                PhoneNumber = orderDto.PhoneNumber
            };

            Database.Orders.Create(order);
            Database.Save();
        }