public ActionResult Create(int DealerId, int CompartmentId, int[] PlotId) { try { // TODO: Add insert logic here if (DealerId > 0 && PlotId.Length > 0) { var plot = new CreateAllocatedPlotInput(); foreach (var Id in PlotId) { plot.DealerId = DealerId; plot.PlotId = Id; if (_allocatedPlotAppService.CreateAllocatedPlot(plot)) { _plotAppService.UpdatePlotAllocation(_plotAppService.GetPlot(Id)); } } return(RedirectToAction("Index", new { Id = DealerId })); } else { ModelState.AddModelError("", "Make sure Dealer and Plot are selected"); return(RedirectToAction("Tallied", "Plots", new { Id = CompartmentId })); } } catch { ModelState.AddModelError("", "Make sure Dealer and Plot are selected"); return(RedirectToAction("Tallied", "Plots", new { Id = CompartmentId })); } }
// GET: Plots public ActionResult PlotDetails(int id) { var plot = _plotAppService.GetPlot(id); var compartment = _compartmentAppService.GetCompartment(plot.CompartmentId); var sheets = _tallySheetAppService.GetTallySheets(plot); ViewBag.Plot = plot; ViewBag.Compartment = compartment; ViewBag.Sheets = sheets; return(View()); }
// GET: TallySheets/Create public ActionResult Create(int id) { var plot = _plotAppService.GetPlot(id); var sheets = _tallySheetAppService.GetTallySheets(plot); var specieCategories = _specieCategoryAppService.GetSpecieCategories().Select(c => new SelectListItem { Value = c.Id.ToString(), Text = c.Name }); ViewBag.SpecieCategoryId = specieCategories; ViewBag.Plot = plot; ViewBag.Sheets = sheets; return(View()); }
// GET: Plots/Edit/5 public ActionResult Edit(int id) { var plot = _plotAppService.GetPlot(id); return(View(plot)); }