public void AddItem(GoodDTO goodDto, int number) { var line = _lineCollection .FirstOrDefault(p => p.Good.Id == goodDto.Id); if (line == null) { _lineCollection.Add(new OrderItemDTO { Good = goodDto, Number = number }); } else { line.Number += number; } }
public void RemoveLine(GoodDTO goodDto) { _lineCollection.RemoveAll(l => l.Good.Id == goodDto.Id); }
public void Add(GoodDTO goodDto) { var good = Mapper.Map<GoodDTO, Good>(goodDto); _repository.Add(good); }
public void Edit(GoodDTO goodDto) { var good = Mapper.Map<GoodDTO, Good>(goodDto); _repository.Edit(good); }
public GoodCreateModel GoodDtoToGoodCreateModel(GoodDTO goodDto) { var goodCreateModel = Mapper.Map<GoodDTO, GoodCreateModel>(goodDto); var categories = _categoryLogic.GetAll(). Select(s => new SelectListItem { Text = s.Name, Value = s.Id.ToString() }).ToList(); var colors = _colorLogic.GetAll(). Select(s => new SelectListItem { Text = s.Name, Value = s.Id.ToString() }).ToList(); goodCreateModel.Categories = categories; goodCreateModel.Colors = colors; return goodCreateModel; }