public async Task <ActionResult> SubmitPurposal(BidViewModels model, string bidPrice) { if (ModelState.IsValid) { var user = User.Identity.GetUserId(); var siteUser = await db.SiteUser.Where(s => s.UserId == user).FirstOrDefaultAsync(); var bid = new Biding { BidPrice = Convert.ToInt32(bidPrice), BidingDate = DateTime.Now.Date, SiteUserID = siteUser.SiteUserID, Description = HttpUtility.HtmlEncode(model.BidDescription), ProjectID = model.ProjectID, Status = "Pending" }; var bidlist = new BidsList { MarkasRead = false, ProjectID = bid.ProjectID }; db.BidsList.Add(bidlist); db.Biding.Add(bid); await db.SaveChangesAsync(); return(RedirectToAction("Index", "SiteUsers")); } return(View(model)); }
public async Task <ActionResult> SubmitPurposal(BidViewModels model) { var pro = await db.Project.Where(p => p.ProjectID == model.ProjectID).FirstOrDefaultAsync(); var BidViewModel = new BidViewModels { ProjectID = pro.ProjectID, ProDescription = HttpUtility.HtmlDecode(pro.Description), ProTitle = pro.Title, }; return(View(BidViewModel)); }
public async Task<ActionResult> ProDetails(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var project = await db.Project.Where(p => p.ProjectID == id).FirstOrDefaultAsync(); if (project == null) { return HttpNotFound(); } else { project.Description = HttpUtility.HtmlDecode(project.Description); int check = 0; var user = User.Identity.GetUserId(); var siteUser = await db.SiteUser.FirstOrDefaultAsync(u => u.UserId == user); if (siteUser != null) { check = await db.Biding.Where(b => b.SiteUserID == siteUser.SiteUserID && b.ProjectID == id).CountAsync(); } var favstatus = await db.FavPro.Where(u => u.Userid == user).FirstOrDefaultAsync(); if (favstatus == null) { ViewBag.FavStatus = false; } var bid = new BidViewModels(); if (check > 0) { bid.Status = true; } else { bid.Status = false; } bid.ProjectID = project.ProjectID; bid.ProTitle = project.Title; bid.ProDescription = project.Description; bid.Location = project.Location; bid.Duration = project.Duration; return View(bid); } }