public ActionResult EditVideos(int partID = 0) { // Get the video types CurtDevDataContext db = new CurtDevDataContext(); List<videoType> types = db.videoTypes.OrderBy(x => x.name).ToList<videoType>(); ViewBag.video_types = types; // Get the part ConvertedPart part = new ConvertedPart(); part = ProductModels.GetPart(partID); ViewBag.part = part; // Get the content List<PartVideo> videos = PartVideoModel.GetPartVideos(partID); ViewBag.videos = videos; ViewBag.active_tab = "videos"; return View(); }
public ActionResult EditReviews(int partID = 0) { // Get the reviews for this product List<ReviewDetail> reviews = new List<ReviewDetail>(); reviews = ReviewModel.GetReviews(partID); ViewBag.reviews = reviews; // Get the part ConvertedPart part = new ConvertedPart(); part = ProductModels.GetPart(partID); ViewBag.part = part; ViewBag.active_tab = "reviews"; return View(); }
public static string AddIncluded(int partID = 0, int includedID = 0, int quantity = 1) { try { if (partID > 0 && includedID > 0) { CurtDevDataContext db = new CurtDevDataContext(); IncludedPart included_part = new IncludedPart(); if(db.IncludedParts.Any(x => x.partID.Equals(partID) && x.includedID.Equals(includedID))) { included_part = db.IncludedParts.Where(x => x.partID.Equals(partID) && x.includedID.Equals(includedID)).FirstOrDefault(); included_part.quantity = quantity; } else { included_part = new IncludedPart { partID = partID, includedID = includedID, quantity = quantity }; db.IncludedParts.InsertOnSubmit(included_part); } db.SubmitChanges(); // get the related parts information ConvertedPart part = new ConvertedPart(); part = GetPart(includedID); UpdatePart(partID); // Serialize and return return JsonConvert.SerializeObject(included_part); } else { return "{\"error\":\"Invalid data.\"}"; } } catch (Exception e) { return "{\"error\":\"" + e.Message + "\"}"; } }
public ActionResult Edit(int partID = 0) { // Get the part ConvertedPart part = new ConvertedPart(); part = ProductModels.GetPart(partID); ViewBag.part = part; // Get the product classes ViewBag.classes = ProductModels.GetClasses(); ViewBag.UPC = ProductModels.GetAttribute(part.partID, "UPC"); ViewBag.PartTypes = new ACES().GetPartTypes(); ViewBag.active_tab = "info"; return View(); }
public static ConvertedPart GetPart(int partID = 0) { CurtDevDataContext db = new CurtDevDataContext(); ConvertedPart part = new ConvertedPart(); part = (from p in db.Parts where p.partID.Equals(partID) select new ConvertedPart { partID = p.partID, status = p.status, dateModified = Convert.ToDateTime(p.dateModified).ToString(), dateAdded = Convert.ToDateTime(p.dateAdded).ToString(), shortDesc = p.shortDesc, oldPartNumber = p.oldPartNumber, priceCode = Convert.ToInt32(p.priceCode), pClass = p.classID, featured = p.featured, ACESPartTypeID = p.ACESPartTypeID, listPrice = String.Format("{0:C}", (from prices in db.Prices where prices.partID.Equals(p.partID) && prices.priceType.Equals("List") select prices.price1 != null ? prices.price1 : (decimal?)0).FirstOrDefault<decimal?>()) }).FirstOrDefault<ConvertedPart>(); return part; }