sonal malhotra

sonal malhotra

  • 1.5k
  • 307
  • 3.7k

after login how to insert Identity name in angular using w

Aug 13 2019 3:42 AM
hi,
 
after login how to insert Identity name in angular using web api ..
 
i failed to insert identity name
 
it is in web api
  1. public IHttpActionResult addcomment(CommentTable objcomment, string id) {  
  2.  int Id = Convert.ToInt32(id);  
  3.  string loggedInUserId = User.Identity.GetUserId();  
  4.  objcomment.CommentedDate = DateTime.Now;  
  5.  objcomment.id = Id;  
  6.  objcomment.UserID = loggedInUserId;  
  7.  objcomment.CreatedBy = User.Identity.Name;  
  8.  ctx.CommentTables.Add(objcomment);  
  9.  ctx.SaveChanges();  
  10.  return Ok(objcomment);  
  11. }  
how to resolve these

Answers (3)