public ActionResult DeleteConfirmed(int id) { VendorProposal vendorproposal = context.VendorProposals.Single(x => x.VendorProposalId == id); context.VendorProposals.Remove(vendorproposal); context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(VendorProposal vendorproposal) { if (ModelState.IsValid) { //context.Entry(vendorproposal).State = EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } return(View(vendorproposal)); }
public ActionResult Create(VendorProposal vendorproposal) { if (ModelState.IsValid) { context.VendorProposals.Add(vendorproposal); context.SaveChanges(); return(RedirectToAction("Index")); } return(View(vendorproposal)); }
public void InsertOrUpdate(VendorProposal vendorproposal) { if (vendorproposal.VendorId == default(int)) { // New entity context.VendorProposals.Add(vendorproposal); } else { // Existing entity context.Entry(vendorproposal).State = EntityState.Modified; } }
public ActionResult Edit(VendorProposal vendorproposal) { if (ModelState.IsValid) { vendorproposalRepository.InsertOrUpdate(vendorproposal); vendorproposalRepository.Save(); return(RedirectToAction("Index")); } else { return(View()); } }
// map a Request for Proposal from a Linq to Xml XElement public RequestForProposal MapFrom(XElement elem) { RequestForProposal rfp = new RequestForProposal(); rfp.ID = new Guid(elem.Attribute("id").Value); rfp.Status = elem.Attribute("status").Value; rfp.Title = elem.Element("title").Value; rfp.Description = elem.Element("description").Value; rfp.CreationDate = DateTime.Parse(elem.Element("creationDate").Value, new CultureInfo("EN-us")); if (elem.Element("completionDate") != null) { rfp.CompletionDate = DateTime.Parse(elem.Element("completionDate").Value, new CultureInfo("EN-us")); } // invited vendors foreach (XElement vendorElem in elem.Element("invitedVendors").Elements("vendor")) { Vendor vendor = VendorRepository.Retrieve(Convert.ToInt32(vendorElem.Attribute("id").Value, new CultureInfo("EN-us"))); rfp.InvitedVendors.Add(vendor); } // map received proposals in the list foreach (var proposal in elem.Element("vendorProposals").Elements("vendorProposal")) { Vendor vendor = VendorRepository.Retrieve(int.Parse(proposal.Attribute("vendorId").Value, new CultureInfo("EN-us"))); VendorProposal vendorProposal = new VendorProposal(vendor.Id); vendorProposal.Value = double.Parse(proposal.Attribute("value").Value, new CultureInfo("EN-us")); vendorProposal.Date = DateTime.Parse(proposal.Attribute("date").Value, new CultureInfo("EN-us")); rfp.VendorProposals.Add(vendor.Id, vendorProposal); } // map best proposal if (elem.Element("bestProposal") != null) { Vendor bestVendor = VendorRepository.Retrieve(Convert.ToInt32(elem.Element("bestProposal").Attribute("vendorId").Value, new CultureInfo("EN-us"))); rfp.BestProposal = new VendorProposal(bestVendor.Id); rfp.BestProposal.Value = double.Parse(elem.Element("bestProposal").Attribute("value").Value, new CultureInfo("EN-us")); rfp.BestProposal.Date = DateTime.Parse(elem.Element("bestProposal").Attribute("date").Value, new CultureInfo("EN-us")); } return(rfp); }
// // GET: /Default1/Delete/5 public ActionResult Delete(int id) { VendorProposal vendorproposal = context.VendorProposals.Single(x => x.VendorProposalId == id); return(View(vendorproposal)); }
// // GET: /Default1/Details/5 public ViewResult Details(int id) { VendorProposal vendorproposal = context.VendorProposals.Single(x => x.VendorProposalId == id); return(View(vendorproposal)); }