public ActionResult SaveCompleted(FormCollection collection) { try { IGenericRepository generics = new GenericRepository(); IReviewRepository reviews = new ReviewRepository(); int PActionID = int.Parse(collection["SourceID"].ToString()); string completed = collection["ckCompleted"]; DateTime dateCompleted = DateTime.Now; ParagraphAction PAction = reviews.getParagraphActionbyID(PActionID); int ReviewID = int.Parse(PAction.ReviewID.ToString()); if (collection["selectedactorsedit"] != null) { collection["users"] = collection["selectedactorsedit"]; UpdateUtils.InsertUsersPerParagraph(collection, PActionID, UpdateUtils.PARAGRAPH_SOURCE); } // string selected = collection["selectedactorsedit"].ToString(); // string[] listselected = selected.Split(','); // int count = listselected.Length; // for (int j = 0; j < count; j++) // { // string key = Membership.GetUser(listselected[j]).ProviderUserKey.ToString(); // } if (completed != null) { PAction.Completed = true; if (collection["edit_date_completed"] != null && collection["edit_date_completed"].Length > 0) { dateCompleted = DateTime.Parse(collection["edit_date_completed"]); } PAction.CompletedDate = dateCompleted; } else { PAction.Completed = false; PAction.DateModified = DateTime.Now; } //Save the rest of the data var deadlineDate = collection["Deadline"] == null ? ((DateTime)PAction.DateStarted).AddDays(30) : DateTime.Parse(collection["Deadline"].ToString()); var startedDate = DateTime.Parse(collection["DateStarted"]); PAction.DeadlineDate = deadlineDate; PAction.DateStarted = startedDate; if (collection["concerns"] != null) { string concern = collection["concerns"]; switch (concern) { case UpdateUtils.URGENT_CONCERN: PAction.ConcernID = UpdateUtils.URGENT_CONCERN_ID; break; case UpdateUtils.POSSIBLE_CONCERN: PAction.ConcernID = UpdateUtils.POSSIBLE_CONCERN_ID; break; case UpdateUtils.LEAST_CONCERN: PAction.ConcernID = UpdateUtils.LEAST_CONCERN_ID; break; case UpdateUtils.NOT_CLASSIFIED: PAction.ConcernID = UpdateUtils.NOT_CLASSIFIED_ID; break; } ParagraphAction topPA = generics.getParagraphActionPerReview(PAction.ReviewID.Value); if (topPA.Id == PAction.Id) { TblReview review = reviews.getSingleReviewEdit(PAction.ReviewID); review.ConcernID = PAction.ConcernID; DB.Save(review); generics.resetCurrentConcernForReview(PAction.ReviewID.Value); PAction.CurrentConcern = true; } } PAction.MeetingID = Int32.Parse(collection["Meetings"]); PAction.DateModified = DateTime.Now; int i= reviews.SavePA(PAction); return RedirectToAction("Details","ProcessReview", new {ID=ReviewID}); } catch { //return View(); return null; } }