示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            UsrStat course = unitOfWork.UsrStatRepository.GetByID(id);

            unitOfWork.UsrStatRepository.Delete(id);
            unitOfWork.Save();
            return(RedirectToAction("Index"));
        }
示例#2
0
        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));
        }
示例#3
0
        //// 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;
        }
示例#4
0
        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));
        }
示例#5
0
        // GET: /Statistica/Edit/5

        public ActionResult Edit(int id)
        {
            UsrStat statistica = unitOfWork.UsrStatRepository.GetByID(id);

            return(View(statistica));
        }
示例#6
0
        // GET: /Statistica/Details/5

        public ViewResult Details(int id)
        {
            UsrStat statistica = unitOfWork.UsrStatRepository.GetByID(id);

            return(View(statistica));
        }