public ActionResult DeleteConfirmed(int id) { UsrStat course = unitOfWork.UsrStatRepository.GetByID(id); unitOfWork.UsrStatRepository.Delete(id); unitOfWork.Save(); return(RedirectToAction("Index")); }
public ActionResult Edit( [Bind(Include = "Id,UserName,LastLogin,LastAction")] UsrStat statistica) { try { if (ModelState.IsValid) { unitOfWork.UsrStatRepository.Update(statistica); unitOfWork.Save(); return(RedirectToAction("Index")); } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name after DataException and add a line here to write a log.) ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator."); } return(View(statistica)); }
//// POST: /Statistica/CreateByUsr //[HttpPost] public void CreateByUsr() { try { if (ModelState.IsValid) { string tmpId = User.Identity.GetUserId(); UsrStat write_st = new UsrStat(tmpId, "Login"); unitOfWork.UsrStatRepository.Insert(write_st); unitOfWork.Save(); return; } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name after DataException and add a line here to write a log.) ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator."); } return; }
public ActionResult Create( [Bind(Include = "Id,UserName,LastLogin,LastRole,LastAction, ModTime,isActive, isEnabled, LastActionTime")] UsrStat statistica) { try { if (ModelState.IsValid) { string tmpId = User.Identity.GetUserId(); UsrStat write_st = new UsrStat(tmpId, "statistica.LastAction"); unitOfWork.UsrStatRepository.Insert(write_st); unitOfWork.Save(); return(RedirectToAction("Index")); } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name after DataException and add a line here to write a log.) ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator."); } return(View(statistica)); }
// GET: /Statistica/Edit/5 public ActionResult Edit(int id) { UsrStat statistica = unitOfWork.UsrStatRepository.GetByID(id); return(View(statistica)); }
// GET: /Statistica/Details/5 public ViewResult Details(int id) { UsrStat statistica = unitOfWork.UsrStatRepository.GetByID(id); return(View(statistica)); }