Exemplo n.º 1
0
        public ActionResult <User> PostUser(User user)
        {
            _postData.AddUser(user);
            _postData.Commit();

            return(CreatedAtAction("GetUser", new { email = user.Email }, user));
        }
 public IActionResult Index(User userDetail)
 {
     if (ModelState.IsValid)
     {
         Users = pd.GetUserByNameAndEmail(userDetail.Name, userDetail.Email).ToList();
         if (Users.Count() == 0)
         {
             pd.AddUser(userDetail);
             ViewBag.message = "User registered!";
         }
         else
         {
             //id = Users[0].UserId;
             return(RedirectToAction("MyPost", "Post", new { id = Users[0].UserId }));
         }
         pd.AddUser(userDetail);
         return(RedirectToAction("MyPost", "Post", new { id }));
     }
     else
     {
         return(View());
     }
 }
Exemplo n.º 3
0
        public IActionResult OnPost()
        {
            int u = postdata.AddUser(User);

            if (u == 1)
            {
                postdata.commit();
            }
            else
            {
                return(RedirectToPage("./RegisteredUser"));
            }

            return(RedirectToPage("./Index"));
        }