Skip to content

Commit

Permalink
- Reset password
Browse files Browse the repository at this point in the history
  • Loading branch information
MandarTisge committed Nov 28, 2014
1 parent 7f5510d commit 1ced0d0
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions FSDTS/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ public List<User> GetUserInfoByUserType(string UType)

if (UType != null)
{
reader = cmd.ExecuteReader();
}
else
{
throw new NullReferenceException("User Type you have entered is not correct.");
}
reader = cmd.ExecuteReader();
while (reader.Read())
{
Expand Down Expand Up @@ -137,6 +143,7 @@ public List<User> GetUserInfoByUserType(string UType)
con.Dispose();
return lstUser;
////return db.ProjectOrganization.Where(p => p.IsDeleted == false).AsQueryable();

}

[Route("Api/GetUserInfoById")]
Expand Down Expand Up @@ -377,7 +384,6 @@ public HttpResponseMessage PatchUser(int id, Delta<User> user)
[ResponseType(typeof(User))]
[HttpPost]
[FsdtsExceptionHandler]
[HttpPost]
public IHttpActionResult PostUser(User user)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -526,17 +532,34 @@ public HttpResponseMessage ForgotPassword(User userObj)
}
else
response.Write("Invalid Request");


}
else
{
response.Write("Failure");
}

return Request.CreateResponse(HttpStatusCode.OK);
}

[FsdtsExceptionHandler]
[AcceptVerbs("PATCH")]
[Route("Api/ResetPassword")]
public HttpResponseMessage ResetPassword(int id, Delta<User> user)
{
FSDTSContext objContext = new FSDTSContext();
User userObj = objContext.User.SingleOrDefault(p => p.UserId == id);
if (userObj == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}

return Request.CreateResponse(HttpStatusCode.OK);
//userObj.UserPassword = user.
user.Patch(userObj);
objContext.Entry(userObj).State = EntityState.Modified;
////objContext.SaveChanges();
db.SaveChanges();
objContext.SaveChanges();
return Request.CreateResponse(HttpStatusCode.NoContent);
}
}
}

0 comments on commit 1ced0d0

Please sign in to comment.