using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace WF.Controllers
{
public class UserController : Controller
{
Models.DAL.UserDal dbuser = new Models.DAL.UserDal();
//
// GET: /User/
public ActionResult UserList()
{
return View(dbuser.FindUserAll());
}
//
// GET: /User/Create
public ActionResult Create()
{
return View();
}
//
// POST: /User/Create
[HttpPost]
public ActionResult Create(FormCollection collection,Models.User_ALL user)
{
try
{
dbuser.Add(user);
dbuser.Save();
return RedirectToAction("UserList");
}
catch
{
return View();
}
}
//
// GET: /User/Edit/5
public ActionResult UserEdit(int id)
{
return View(dbuser.FindUserAllById(id));
}
//
// POST: /User/Edit/5
[HttpPost]
public ActionResult UserEdit(Models.User_ALL user, FormCollection collection)
{
try
{
dbuser.Update(user);
dbuser.Save();
return RedirectToAction("UserList");
}
catch
{
return View();
}
}
}
}