public ActionResult Edit(int? id, string text) { var viewModel = new MedicineLaboratoryViewModel() { Name = text }; if (id.HasValue) { var laboratory = this.db.Laboratories.FirstOrDefault(l => l.Id == id); if (laboratory == null) return this.ObjectNotFound(); viewModel = this.GetViewModel(laboratory); } // the resulting view will depend on the request type return this.Request.IsAjaxRequest() ? View("EditModal", viewModel) : View("Edit", viewModel); }
public ActionResult Create(MedicineLaboratoryViewModel viewModel) { return this.Edit(viewModel); }