Example #1
0
        public bool UserSignup(UContext obj)
        {
            ctx.UserContexts.Add(obj);
            int b = ctx.SaveChanges();

            return(b > 0);
        }
Example #2
0
        public UContext getUser(int id)
        {
            UContext user = ctx.UserContexts.Find(id);

            if (user == null)
            {
                return(user);
            }
            return(user);
        }
        public void AddUser_StatusCode()
        {
            UContext u = new UContext()
            {
                Uname = "user1", password = "******", usertype = "user", email = "*****@*****.**", pnumber = 123, confirmed = "no"
            };
            var Result = lc.Signup(u) as ObjectResult;

            Assert.AreEqual(201, Result.StatusCode.Value);
        }
Example #4
0
        public IActionResult getUserbyId(int id)
        {
            UContext vrm = repo.getUser(id);

            if (vrm == null)
            {
                return(NotFound("user not found"));
            }

            return(Ok(vrm));
        }
Example #5
0
        public string UpdateProfile(UContext newus)
        {
            UContext oldus = ctx.UserContexts.Find(newus.ID);

            oldus.email    = newus.email;
            oldus.pnumber  = newus.pnumber;
            oldus.Uname    = newus.Uname;
            oldus.password = newus.password;
            ctx.UserContexts.Update(oldus);
            ctx.SaveChanges();
            return("Update Successful");
        }
Example #6
0
        public IActionResult Signup(UContext user)
        {
            if (ModelState.IsValid == false)
            {
                return(BadRequest(ModelState));
            }
            var result = repo.UserSignup(user);

            if (!result)
            {
                return(BadRequest("Error saving data"));
            }
            return(Created("No url", new { message = "created successfully" }));
        }
Example #7
0
        public IActionResult UpdateProfile(UContext user)
        {
            string upduser = repo.UpdateProfile(user);

            return(Ok(upduser));
        }