public ActionResult Create() { var model = new OrderCreateViewModel(); var user = authService.GetCurrentUser(); model.UserId = user.Id; return View(model); }
public ActionResult Create(OrderCreateViewModel model) { if (!this.ModelState.IsValid) { return View(model); } var user = this.authService.GetCurrentUser(); if (user.Id != model.UserId) { this.ModelState.AddModelError(string.Empty, "Что-то тут не так... перегрузите страницу."); return this.View(model); } this.orderService.Create(model.GetDomain()); return RedirectToAction("Index", "Home"); }