public JsonResult GetNextColorNumber(int colorID) { try { return(Json(PolishModel.getNextColorNumber(colorID))); } catch (Exception ex) { return(Json(ex.Message)); } }
public ActionResult Details(PolishModel polish) { using (var db = new PolishWarehouseEntities()) { try { polish.Save(); TempData["Messages"] = "Polish Saved!"; } catch (Exception ex) { TempData["Errors"] = "Error: " + ex.Message; } return(RedirectToAction("Details")); } }
public ActionResult Details(int?id) { ViewBag.PrimaryColors = PolishModel.getPrimaryColors().OrderBy(c => c.Name); ViewBag.SecondaryColors = PolishModel.getSecondaryColors().OrderBy(c => c.Name); ViewBag.GlitterColors = PolishModel.getGlitterColors().OrderBy(c => c.Name); ViewBag.Brands = PolishModel.getBrands().OrderBy(c => c.Name); ViewBag.PolishTypes = PolishModel.getPolishTypes().OrderBy(c => c.Name); if (id.HasValue) { return(View(new PolishModel(id.Value))); } else { return(View(new PolishModel())); } }
public ActionResult UploadFile(HttpPostedFileBase file) { if (file.ContentLength > 0) { try { //Do stuff with the file PolishModel.processCSV(file); } catch (Exception ex) { TempData["Errors"] = "Error: " + ex.Message; return(RedirectToAction("Import")); } } TempData["Messages"] = "File Uploaded!"; return(RedirectToAction("Import")); }
public JsonResult GetPolishQuickInfo(string colorName) { try { using (var db = new PolishWarehouseEntities()) { var c = db.Colors.Where(b => b.Name == colorName).SingleOrDefault(); if (c == null) { throw new Exception("Color Doesn't exist!"); } return(Json(new { id = c.ID, number = PolishModel.getNextColorNumber(c.ID) })); } } catch (Exception ex) { return(Json(ex.Message)); } }
public JsonResult DetailsAsync(int id) { var model = new PolishModel(id, false); return(Json(model)); }
public ActionResult Public() { ViewBag.PolishTypes = PolishModel.getPolishTypes().OrderBy(c => c.Name); return(Index()); }