Success
// ************************************** p>
ActionResult ChangePasswordSuccess ()
{
return View ();
}
}
}
Контролер для В«ТоварівВ»
using System; System.Collections.Generic; System.Linq; System.Web; System.Web.Mvc; FurnitureCatalog.Models;
FurnitureCatalog.Controllers
{class ItemController: Controller
{DataManager _dataManager;
ItemController (DataManager dataManager)
{
_dataManager = dataManager;
}
//
// GET:/Item/
ActionResult Item (int id)
{["Title"] = "Список товарів"; ["Items"] = _dataManager.Items.GetItemsNotSort ();. Model = _dataManager.Items.GetItem (id); View ();
}
ActionResult Delete (int id)
{
_dataManager.Items.DeleteItem (id); RedirectToAction ("Index", "Home");
}
[AcceptVerbs (HttpVerbs.Get)] ActionResult Edit (int id)
{s = _dataManager.Items.GetItem (id);
. Model = s; (s); View ();
}
void SetEditLists (Items s)
{["Sellers"] = new SelectList (_dataManager.Sellers.GetSellers (), "SellerId", "SellerName", s.SellerId); ["States"] = new SelectList (_dataManager.States.GetStates (), "StateId", "StateName", s.StateId); ["Producers"] = new SelectList (_dataManager.Producers.GetProducers (), "ProducerId", "ProducerName", s.ProducerId);
}
[AcceptVerbs (HttpVerbs.Post)] ActionResult Edit (int id, Items s)
{
(s.ItemName.Length <3) ModelState.AddModelError ("ItemName", "Ім'я виробника має бути більше 2 символів!"); (s.Description! = null & & s.Description.Length <3) ModelState.AddModelError ("Description", "Опис повинен бути більше 2 символів!"); (s); (ModelState.IsValid)
{. ItemId = id;
_dataManager.Items.UpdateItem (s);
// return RedirectToAction ("Item", new {id = s.ItemId}); RedirectToAction ("Item", "Item", new {id = s.ItemId});
}
View ();
}
[AcceptVerbs (HttpVerbs.Get)] ActionResult Add ()
{["Sellers"] = new SelectList (_dataManager.Sellers.GetSellers (), "SellerId", "SellerName"); ["Items"] = _dataManager.Items.GetItemsNotSort (); View ();
...