public ActionResult ToggleState(string id) { var response = new JsonResultBody(); try { Origin origin = _repository.GetOriginById(id); response.Data = _repository.Delete(origin); } catch (DbEntityValidationException ex) { response.Status = System.Net.HttpStatusCode.InternalServerError; foreach (DbEntityValidationResult result in ex.EntityValidationErrors) { response.Errors = (from ve in result.ValidationErrors select ve.ErrorMessage).ToList(); } } catch (Exception exApp) { response.Status = System.Net.HttpStatusCode.InternalServerError; response.Errors.Add(exApp.Message); } return(Json(response)); }
public ActionResult Edit(Guid id) { var origin = originRepository.GetOriginById(id); OriginVM model = new OriginVM(); if (origin != null && origin.Count > 0) { model = origin[0]; return(View(model)); } return(RedirectToAction("List")); }