public ActionResult BlockForecast(BlockForecastViewModel model)
        {
            //This will hold the value returned from the stored proc to determine success of failure of the stored proc.
            int?retVal = 0;

            //First, we'll check to see if we're deleting this.  No real checks needed if that's the case.
            if (model.submitType == SubmitType.delete)
            {
                //Run the delete stored proc.
                Repository.DeleteHarvestForecast(model.blockId, ref retVal);

                if (retVal == 1)
                {
                    //Success.  Send user to success page.
                    return(RedirectToAction("ForecastDeleteSuccess", "BlockForecast"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "There was an error trying to delete the forecast.  Error code: " + retVal);
                    return(View(model));
                }
            }
            else
            {
                //Do a couple quick checks here for data quality.
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                //Check to see if this is a save or a delete.
                if (model.submitType == SubmitType.save)
                {
                    //This is a save.  Run the stored proc.
                    Repository.ModifyHarvestForecast(model.blockId, model.cropYear, model.forcastValue, ref retVal);

                    //Check the return value for successful update.
                    if (retVal == 1)
                    {
                        //Success.  Send to the update success page.
                        return(RedirectToAction("ForecastUpdateSuccess", "BlockForecast"));
                    }
                    //Check the return value for successful add.
                    else if (retVal == 2)
                    {
                        //Success.  Send to the add success page.
                        return(RedirectToAction("ForecastAddedSuccess", "BlockForecast"));
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, "There was an error trying to update the forecast.  Error code: " + retVal);
                        return(View(model));
                    }
                }

                return(View(model));
            }
        }