public void AddBoxMod(BoxModDTO boxModDto) { BoxMod boxMod = new BoxMod { Name = boxModDto.Name, Company = boxModDto.Company, Accumulator = boxModDto.Accumulator, Brand = boxModDto.Brand, Amount = boxModDto.Amount, Contry = boxModDto.Contry, Outturn = boxModDto.Outturn, Price = boxModDto.Price, }; Database.BoxMods.Create(boxMod); Database.Save(); }
public void Add(ImageBoxModDTO imageBoxModDto) { BoxMod boxMod = Database.BoxMods.Get(imageBoxModDto.BoxModId); // валидация if (boxMod == null) { throw new ValidationException("FullVape не найден", ""); } ImageBoxMod imageBoxMod = new ImageBoxMod { Data = imageBoxModDto.Data, MimeType = imageBoxModDto.MimeType, BoxModId = boxMod.Id, }; Database.ImageBoxMods.Create(imageBoxMod); Database.Save(); }
public void MakeOrderBoxMod(OrderDTO orderDto) { BoxMod boxMod = Database.BoxMods.Get(orderDto.BoxModId); // валидация if (boxMod == null) { throw new ValidationException("BoxMod не найден", ""); } decimal sum = boxMod.Price; Order order = new Order { Date = DateTime.Now, Address = orderDto.Address, BoxModId = boxMod.Id, Sum = sum, PhoneNumber = orderDto.PhoneNumber }; Database.Orders.Create(order); Database.Save(); }