public ActionResult Details(int id)
 {
     Models.ProjectDetailsModel project = new Models.ProjectDetailsModel(id);
     if (project.project.ProjectDetails == null)
     {
         return(new HttpNotFoundResult("The project you requested does not exist or is not public"));
     }
     else
     {
         return(View(project));
     }
 }
        public ActionResult Details(int id, FormCollection formCollection)
        {
            Dictionary <string, string> objDictionary = new Dictionary <string, string>();

            Models.ProjectDetailsModel project = new Models.ProjectDetailsModel(id);
            foreach (string key in formCollection)
            {
                objDictionary.Add(key, formCollection.GetValue(key).AttemptedValue);
            }

            // make sure revenue exists
            if (!string.IsNullOrEmpty(objDictionary["Revenue_Percentage"]))
            {
                // make sure revenue is positive and non-zero
                if (decimal.Parse(objDictionary["Revenue_Percentage"]) <= 0)
                {
                    ModelState.AddModelError("Negative_Revenue_Return", "Please specify a positive non-zero value for revenue return");
                }
            }
            else
            {
                ModelState.AddModelError("Revenue_Return_NULL", "Please enter a revenue percentage to purchase with this PROC");
            }

            // make sure investment exists
            if (!string.IsNullOrEmpty(objDictionary["Investment_Amount"]))
            {
                // make sure investment is positive and nom-zero
                if (decimal.Parse(objDictionary["Investment_Amount"]) <= 0)
                {
                    ModelState.AddModelError("Negative_Investment", "Please enter a positive non-zero value for investment");
                }
            }
            else
            {
                ModelState.AddModelError("Investment_Amount_NULL", "Please enter a value for investment in this PROC");
            }

            // make sure we have a begin date
            if (string.IsNullOrEmpty(objDictionary["date_begin"]))
            {
                ModelState.AddModelError("begin_date_NULL", "please enter a start date");
            }

            // make sure we have an end date
            if (string.IsNullOrEmpty(objDictionary["date_end"]))
            {
                ModelState.AddModelError("end_date_NULL", "please enter an end date");
            }

            // make sure the dates make sense
            if (!string.IsNullOrEmpty(objDictionary["date_begin"]) && !string.IsNullOrEmpty(objDictionary["date_end"]))
            {
                if (DateTime.Parse(objDictionary["date_begin"]) > DateTime.Parse(objDictionary["date_end"]))
                {
                    ModelState.AddModelError("invalid_dates", "Please make sure the start date is before the end date for the PROC aggrement");
                }
            }

            // if no errors are present then submit the PROC
            if (!ModelState.Values.Any(x => x.Errors.Count > 0))
            {
                int new_PROC_Id = new ServiceReference1.Service1Client().create_PROC(
                    HttpContext.GetOwinContext().Authentication.User.FindFirst(ClaimTypes.Sid).Value,
                    //int.Parse(objDictionary["Investor_Id"]),
                    int.Parse(Session["Investor_Id"].ToString()),
                    int.Parse(objDictionary["Project_Id"]),
                    objDictionary
                    );
                return(Redirect(string.Format("/PROC/Details/{0}", new_PROC_Id)));
            }
            else
            {
                return(View(project));
            }
        }