public bool UserSignup(UContext obj) { ctx.UserContexts.Add(obj); int b = ctx.SaveChanges(); return(b > 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); }
public IActionResult getUserbyId(int id) { UContext vrm = repo.getUser(id); if (vrm == null) { return(NotFound("user not found")); } return(Ok(vrm)); }
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"); }
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" })); }
public IActionResult UpdateProfile(UContext user) { string upduser = repo.UpdateProfile(user); return(Ok(upduser)); }