//POST: Rename Picture public ActionResult Rename(PictureModel picture) { //TODO: Check if ModelState is valid if (ModelState.IsValid) { //TODO: Tell picture manager to rename picture var isRenamed = _pictureManager.RenamePicture(picture); //TODO: If rename is successfull, do the following if (isRenamed) { //TODO: Return to index with success alert msg TempData[Alert.AlertMsgKey] = "Picture has been renamed successfully"; TempData[Alert.AlertTypeKey] = Alert.AlertSuccess; return(RedirectToAction("Index", "Picture", new { albumID = picture.AlbumID, alert = true })); } //TODO: On failure to rename, return to index with error alert TempData[Alert.AlertMsgKey] = "Sorry, picture couldn't be renamed. Please try again"; TempData[Alert.AlertTypeKey] = Alert.AlertDanger; return(RedirectToAction("Index", "Picture", new { albumID = picture.AlbumID, alert = true })); } //TODO: If ModelState isn't valid, return to index with error alert TempData[Alert.AlertMsgKey] = "Sorry, picture couldn't be renamed. Please try again"; TempData[Alert.AlertTypeKey] = Alert.AlertDanger; return(RedirectToAction("Index", "Picture", new { albumID = picture.AlbumID, alert = true })); }