public IActionResult LoggedInBidRequest(VMLoggedBR lvm) { if (ModelState.IsValid) { BidRequest bidreq = new Models.BidRequest(); var userID = UserManager.GetUserId(HttpContext.User); UserIdentity user = UserManager.Users.FirstOrDefault(u => u.Id == userID); bidreq.User = user; bidreq.User.UserName = user.Email; bidreq.User.Email = user.Email; bidreq.User.FirstName = lvm.CustomerFirst; bidreq.User.LastName = lvm.CustomerLast; bidreq.BidRequestID = lvm.BidRequestID; bidreq.Concrete = lvm.Concrete; bidreq.FrameWork = lvm.FrameWork; bidreq.NewBuild = lvm.NewBuild; bidreq.ProjectDescription = lvm.ProjectDescription; bidreq.ProjectLocation = lvm.ProjectLocation; bidreq.Remodel = lvm.Remodel; bidreq.Responded = false; bidreq.DateCreated = DateTime.Now; bidReqRepo.Update(bidreq); return(RedirectToAction("Success")); } return(View(lvm)); }
public IActionResult LoggedInBidRequest() { //getting the user info to auto populate the fields, nts only works if the value and placeholder attributes are not there VMLoggedBR logBR = new VMLoggedBR(); var userID = UserManager.GetUserId(HttpContext.User); UserIdentity user = UserManager.Users.FirstOrDefault(u => u.Id == userID); logBR.CustomerFirst = user.FirstName; logBR.CustomerLast = user.LastName; return(View(logBR)); }