Exemplo n.º 1
0
        public ActionResult Edit(long id, string title, string burl, string bpic)
        {
            var user = repository.FirstOrDefault(m => m.id == id);

            if (user == null)
            {
                return(HttpNotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    user.title = title;
                    user.burl  = burl;
                    user.bpic  = bpic;
                    repository.Update(user);
                    repository.UnitOfWork.Commit();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.id))
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(user));
        }
Exemplo n.º 2
0
        public ActionResult Edit(long id, int count, string remark)
        {
            var user = repository.FirstOrDefault(m => m.id == id);

            if (user == null)
            {
                return(HttpNotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    user.count  = count;
                    user.remark = remark;

                    repository.Update(user);
                    repository.UnitOfWork.Commit();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.id))
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(user));
        }
        public ActionResult Edit(long id, string kpic, string kurl, string ktitle, string kpop, string kspic, string kteach, string kshi, string kmiao, string kmony, string ty)
        {
            var user = repository.FirstOrDefault(m => m.id == id);

            if (user == null)
            {
                return(HttpNotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    user.kpic   = kpic;
                    user.ktitle = ktitle;
                    user.kpop   = kpop;
                    user.kspic  = kspic;
                    user.kteach = kteach;
                    user.kshi   = kshi;
                    user.kmiao  = kmiao;
                    user.kmony  = kmony;
                    user.ty     = ty;
                    user.kurl   = kurl;
                    repository.Update(user);
                    repository.UnitOfWork.Commit();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.id))
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(user));
        }
Exemplo n.º 4
0
        public ActionResult Edit(long id, string dpic, string dname, string dnichen, string djibie, string djies)
        {
            var user = repository.FirstOrDefault(m => m.id == id);

            if (user == null)
            {
                return(HttpNotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    user.dpic    = dpic;
                    user.dname   = dname;
                    user.dnichen = dnichen;
                    user.djibie  = djibie;
                    user.djies   = djies;
                    repository.Update(user);
                    repository.UnitOfWork.Commit();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.id))
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(user));
        }