public ActionResult UpdateContact(Contact c)
        {
            if (ModelState.IsValid)
            {
                using (DB_A9_SoftwareEntities3 db = new DB_A9_SoftwareEntities3())
                {
                    db.Contacts.Where(x => x.UserId.Equals(@Session["LoggedId"]) && c.UserId.Equals(@Session["LoggedId"]));

                    //db.Contacts.Add(c).Equals(db.Contacts.Where(x => x.UserId.Equals(@Session["LoggedId"]) && c.UserId.Equals(@Session["LoggedId"])));
                    db.SaveChanges();
                    ModelState.Clear();
                    c = null;
                    ViewBag.Message = "Contact is Update successfully";
                }
            }

            return(View(c));
        }
Esempio n. 2
0
        public ActionResult Register(Register u)
        {
            if (ModelState.IsValid)
            {
                using (DB_A9_SoftwareEntities3 db = new DB_A9_SoftwareEntities3())
                {
                    u.Role_Id  = 1;
                    u.CanLogin = true;
                    u.IsAdmin  = false;
                    db.Registers.Add(u);
                    db.SaveChanges();
                    ModelState.Clear();
                    u = null;
                    ViewBag.Message = "Registration is Successful";

                    if (ViewBag.Message != null)
                    {
                        return(RedirectToAction("Login", "Account"));
                    }
                }
            }
            return(View(u));
        }