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(); }
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(); }
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(); }