Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,Useremail,UserPassword,UserType,UserStatus")] Gauser gauser)
        {
            if (id != gauser.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gauser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GauserExists(gauser.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(gauser));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("UserId,Useremail,UserPassword,UserType,UserStatus")] Gauser gauser)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gauser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(gauser));
        }
Exemple #3
0
        public ActionResult Validate(Gauser gauser)
        {
            var _gauser = _context.Gauser.Where(_context => _context.Useremail == gauser.Useremail);

            if (_gauser.Any())
            {
                if (_gauser.Where(_context => _context.UserPassword == gauser.UserPassword).Any())
                {
                    return(Json(new { status = true, message = "Login Successfull" }));
                }
                else
                {
                    return(Json(new { status = true, message = "Invalid Password" }));
                }
            }
            else
            {
                return(Json(new { status = true, message = "Invalid Email" }));
            }
        }