コード例 #1
0
        public ActionResult Create(Referree pReferree)
        {
            try
            {
                // TODO: Add insert logic here
                db.Referrees.Add(pReferree);
                db.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return View("~/Views/Shared/Error.cshtml");
            }
        }
コード例 #2
0
 public ReferreeRoleViewModel(Referree referree, Position role)
 {
     _referree = referree;
     _role = role;
 }
コード例 #3
0
        public ActionResult Edit(string id, Referree pReferree)
        {
            try
            {
                // TODO: Add update logic here
                Referree _referree = null;
                foreach (Referree _ref in db.Referrees)
                {
                    if (_ref.ReferreeName == Server.UrlDecode(id))
                    {
                        _referree = _ref;
                    }
                }
                if (_referree != null)
                {
                    _referree.Role = pReferree.Role;
                    _referree.Phone = pReferree.Phone;
                    _referree.Email = pReferree.Email;

                    db.SaveChanges();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View("~/Views/Shared/Error.cshtml");
            }
        }