Exemplo n.º 1
0
 //Add Users to Table
 public JsonResult InsertUser([Bind(Exclude = "ID")] User User)
 {
     if (ModelState.IsValid)
     {
         try
         {
             if (UserBL.InsertUser(User) > 0)
             {
                 return(Json(new { isError = "F", message = "New user has been added!" }));
             }
             else
             {
                 return(Json(new { isError = "T", message = "Email address already exist." }));
             }
         }
         catch (Exception ex)
         {
             return(Json(new { isError = "T", message = "Could not insert data." }));
         }
     }
     else
     {
         return(Json(new { isError = "T", message = "Could not insert data." }));
     }
 }
Exemplo n.º 2
0
        public string InsertUser([Bind(Exclude = "ID")] User User)
        {
            string msg;

            if (ModelState.IsValid)
            {
                if (UserBL.InsertUser(User) > 0)
                {
                    msg = "Data Inserted Successfully";
                }
                else
                {
                    msg = "Error. Could Not Insert Data";
                }
            }
            else
            {
                msg = "Sorry! Validation Error";
            }

            return(msg);
        }