public ActionResult Restore(string year, int id)
        {
            //Restore projectVersionID (ID) to the given TIPYear (year)
            IRestoreStrategy strategy = new RestoreStrategy(this._projectRepository, id).PickStrategy();
            int returnId = (int)strategy.Restore(year);
            id = returnId != 0 ? returnId : id;

            return RedirectToAction("Funding", new { controller = "Project", id = id, message = "Project restored successfully." });
        }
Example #2
0
 public JsonResult Restore(string timePeriod, int id)
 {
     int result = default(int);
     try
     {
         IRestoreStrategy strategy = new RestoreStrategy(this._projectRepository, id).PickStrategy();
         result = (int)strategy.Restore(timePeriod);
     }
     catch (Exception ex)
     {
         return Json(new
         {
             message = "Changes could not be stored. An error has been logged."
             ,
             error = "true"
             ,
             exceptionMessage = ex.Message
         });
     }
     return Json(new
     {
         data = result
             //data = new
             //{
             //    RtpYear = result.RtpYear,
             //    Title = result.Title,
             //    ProjectVersionId = result.ProjectVersionId,
             //    COGID = result.COGID,
             //    AmendmentStatus = result.AmendmentStatus,
             //    ImprovementType = result.ImprovementType,
             //    SponsorAgency = result.SponsorAgency
             //}
         ,
         message = "Project successfully restored to " + timePeriod + "."
         ,
         error = "false"
     });
 }