Exemple #1
0
        public ActionResult Detail(int?Id)
        {
            var _user = _db.UserLogins.Find(User.Identity.Name);

            if (_user != null && _user.sessionId != HttpContext.Session.SessionID)
            {
                AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            }
            LienKetWeb model = null;

            if (Id.HasValue && Id > 0)
            {
                model         = _services.GetById(Id.Value);
                ViewBag.Title = "Cập nhật liên kết";
            }
            else
            {
                model = new LienKetWeb
                {
                    isSort       = 0,
                    lienKetWebId = 0
                };
                ViewBag.Title = "Thêm mới liên kết";
            }
            return(View(model));
        }
Exemple #2
0
 public ActionResult Detail(LienKetWeb entity)
 {
     if (ModelState.IsValid)
     {
         if (entity.lienKetWebId > 0)
         {
             LienKetWeb model = _services.GetById((int)entity.lienKetWebId);
             model.lienKetWebName = entity.lienKetWebName;
             model.lienKetWebLink = entity.lienKetWebLink;
             model.isSort         = entity.isSort;
             _services.Update(model, User.Identity.Name);
             _services.Save();
         }
         else
         {
             LienKetWeb model = new LienKetWeb
             {
                 isSort         = entity.isSort,
                 lienKetWebLink = entity.lienKetWebLink,
                 lienKetWebName = entity.lienKetWebName
             };
             _services.Add(model, User.Identity.Name);
             _services.Save();
         }
         return(RedirectToAction("Index"));
     }
     return(View(entity));
 }
 public void Update(LienKetWeb _model, string _userName)
 {
     _Repository.Update(_model);
     try
     {
         LogAction entity = new LogAction();
         entity.action     = "Sửa LienKetWeb: <a href=\"" + _model.lienKetWebId + "\" target=\"_blank\">" + _model.lienKetWebName + "</a>";
         entity.browser    = "";
         entity.ipAddress  = "";
         entity.userAction = _userName;
         entity.createTime = DateTime.Now;
         _RepositoryLogAction.Add(entity);
     }
     catch
     {
     }
 }
Exemple #4
0
        public ActionResult Detail(int?Id)
        {
            LienKetWeb entity;

            if (Id.HasValue && Id > 0)
            {
                entity        = _services.GetById(Id.Value);
                ViewBag.Title = "Cập nhật liên kết website";
            }
            else
            {
                entity = new LienKetWeb
                {
                    isTrash = false
                };
                ViewBag.Title = "Thêm mới liên kết website";
            }
            return(View(entity));
        }
Exemple #5
0
 public ActionResult Detail(LienKetWeb entity)
 {
     if (ModelState.IsValid)
     {
         if (entity.lienKetId > 0)
         {
             var model = _services.GetById(entity.lienKetId);
             model.lienKetName = entity.lienKetName;
             model.lienKetLink = entity.lienKetLink;
             model.isSort      = entity.isSort;
             _services.Update(model);
             _services.Save();
             _serviceLog.Add(new ActionLog {
                 actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Cập nhật liên kết website Id:" + model.lienKetId, userIp = "", userName = User.Identity.Name
             });
             _serviceLog.Save();
         }
         else
         {
             var model = new LienKetWeb();
             model.lienKetName = entity.lienKetName;
             model.isSort      = entity.isSort;
             model.parentId    = entity.parentId;
             model.lienKetLink = entity.lienKetLink;
             model.isTrash     = false;
             _services.Add(model);
             _services.Save();
             _serviceLog.Add(new ActionLog {
                 actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Thêm mới liên kết website Id:" + model.lienKetId, userIp = "", userName = User.Identity.Name
             });
             _serviceLog.Save();
         }
         return(RedirectToAction("Index"));
     }
     return(View(entity));
 }
 public void Update(LienKetWeb model)
 {
     _Repository.Update(model);
 }
 public LienKetWeb Add(LienKetWeb model)
 {
     return _Repository.Add(model);
 }