public ActionResult CustomerCentral() //view where customer can view a list of their projects { ViewBag.Message = "View your projects."; string id = GetTheCurrentId(); var data = GigManager.LoadGig(id); List <Gig> myListOfGigs = new List <Gig>(); foreach (var row in data) { Gig g = new Gig { Id = row.Id, Title = row.Title, Type = row.Type, Footprint = row.Footprint, Description = row.Description, Zipcode = row.Zipcode, Price = row.Price, CreationDate = row.CreationDate }; g.Price = FindLowestBid(Convert.ToInt32(g.Id)); //updates the price to the lowest bid. g.PriceToString(); myListOfGigs.Add(g); } return(View(myListOfGigs)); }
[Authorize(Roles = "Company")] //this means the user must be signed in as a contractor public ActionResult CompanyCentral() //View where contractors can see what projects are available to have bids on { ViewBag.Message = "Bid on a project."; var data = GigManager.LoadGigs(); List <Gig> myListOfGigs = new List <Gig>(); foreach (var row in data) { Gig g = new Gig { Id = row.Id, Title = row.Title, Type = row.Type, Footprint = row.Footprint, Description = row.Description, Zipcode = row.Zipcode, Price = row.Price, CreationDate = row.CreationDate }; g.Price = FindLowestBid(Convert.ToInt32(g.Id)); g.PriceToString(); myListOfGigs.Add(g); } return(View(myListOfGigs)); }
public ActionResult CreateGig(Gig gig) //takes the data from view and adds the gig to the database. { ViewBag.Message = "Create a gig"; if (ModelState.IsValid) { if (!string.IsNullOrWhiteSpace(gig.Title) && !string.IsNullOrWhiteSpace(gig.Zipcode)) { string ownerId = User.Identity.GetUserId(); int recordsCreated = GigManager.PutInGig(ownerId, gig.Title, gig.Type, gig.Footprint, gig.Description, gig.Zipcode, -2); //-2 is the code for no price set return(RedirectToAction("CustomerCentral")); } } return(View()); }
public ActionResult DeleteGig(string gigId) //View confirms to the customer that he/she wants to delete the project { var data = GigManager.LoadSpecificGig(gigId); Gig gig = new Gig { Id = data.Id, Title = data.Title, Type = data.Type, Footprint = data.Footprint, Description = data.Description, Zipcode = data.Zipcode, Price = data.Price, CreationDate = data.CreationDate }; return(View(gig)); }
public ActionResult PlaceBid(string id) //View where contractor can place a bid on a specific gig { Gig gig; var data = GigManager.LoadSpecificGig(id); gig = new Gig { Id = data.Id, Title = data.Title, Type = data.Type, Footprint = data.Footprint, Description = data.Description, Zipcode = data.Zipcode, Price = data.Price, CreationDate = data.CreationDate }; gig.PriceToString(); return(View(gig)); }
public ActionResult DeleteGigPerm(string gigId) //permanantly deletes the gig from the database { GigManager.RemoveAGig(gigId); return(RedirectToAction("CustomerCentral")); }