public ActionResult ParentDefIndex(MenuMapViewModel menuMapViewModel) { try { var collectionIds = (string[])Session["appValues"]; var group=_repository.Find<MenuMap>(Guid.Parse(collectionIds.FirstOrDefault())); var groupid=group.GroupId; foreach (var n in collectionIds) { var model = _repository.Find<MenuMap>(Guid.Parse(n)); model.Maker = User.Identity.GetUserName(); model.OsysDateTime = DateTime.Now; model.EditDateTime = DateTime.Now; model.ParentName =menuMapViewModel.ParentName; _repository.SaveChanges(); } return RedirectToAction("Index", new { id = groupid }); } catch (Exception ex) { _logs.LogError(User.Identity.GetUserName(), "AuditTrailExportData", "Error: " + ex.Message, Request.ServerVariables["REMOTE_ADDR"], HttpContext.Server.MapPath("."), "System"); System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("~/errorLOG.txt"), System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter s = new System.IO.StreamWriter(fs); s.BaseStream.Seek(0, System.IO.SeekOrigin.End); s.WriteLine("ERROR DATE: " + System.DateTime.Now.ToString(System.Globalization.CultureInfo.InvariantCulture) + " \nERROR MESSAGE: " + ex.Message + "\nSOURCE: " + ex.Source + "\nFORM NAME: " + System.Web.HttpContext.Current.Request.Url.ToString() + "\nQUERYSTRING: " + Request.QueryString.ToString() + "\nTARGETSITE: " + ex.TargetSite.ToString() + "\nSTACKTRACE: " + ex.StackTrace + System.Diagnostics.EventLogEntryType.Error); s.WriteLine("-------------------------------------------------------------------------------------------------------------"); s.Close(); return HttpNotFound(); } }
public ActionResult ParentDefIndex() { try { var terms = new List<string>(); var collectionIds = (string[])Session["appValues"]; foreach (var n in collectionIds) { var getTerm = _repository.Find<MenuMap>(Guid.Parse(n)); terms.Add("Application NAME: " + getTerm.ParentName); } var communityViewModel = new MenuMapViewModel(); return View(communityViewModel); } catch (Exception ex) { //_logs.LogError(User.Identity.GetUserName(), "AppDefAssignCreate_HTTPGET", "Error: " + ex.Message, // Request.ServerVariables["REMOTE_ADDR"]); return HttpNotFound(); } }