Esempio n. 1
0
        public ActionResult Add(AddLotViewModel model)
        {
            if (ModelState.IsValid)
            {
                var lot = Mapper.Map <Lot>(model);
                lot.Images = new List <Image>();
                if (model.Urls != null)
                {
                    foreach (var u in model.Urls)
                    {
                        lot.Images.Add(new Image()
                        {
                            Url = u
                        });
                    }
                }
                TempData.Remove("imgCount");
                var user = userService.GetUserByEmail(User.Identity.Name);
                lot.Seller = user;
                user.Lots.Add(lot);
                lotService.AddLot(lot);
                return(RedirectToAction("Details", new { id = lot.LotId }));
            }

            return(View(model));
        }
        public AddLotWindow(FormMode action)
        {
            InitializeComponent();

            this.Loaded += OnLoaded;

            if (action == FormMode.Add)
            {
                DataContext = new AddLotViewModel();
            }
            else if (action == FormMode.Update)
            {
                DataContext = new UpdateLotViewModel();
            }
        }
Esempio n. 3
0
 public AddLotView(string login)
 {
     InitializeComponent();
     DataContext       = new AddLotViewModel();
     currentUser.login = login;
 }