public ActionResult GridViewPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ViewModels.EmployeeViewModel item) { if (ModelState.IsValid) { try { // Insert here a code to delete the item from your model Delete(item); } catch (Exception e) { ViewData["EditError"] = e.Message; } } return(PartialView("_GridViewPartial", GetEmployees())); }
public ActionResult GridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ViewModels.EmployeeViewModel item) { if (ModelState.IsValid) { try { // Insert here a code to update the item in your model Save(item); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GridViewPartial", GetEmployees())); }
public ActionResult GetViewModel() { Employee emp = new Employee(); emp.FirstName = "Pinnuri"; emp.LastName = "Vikas"; emp.Salary = 1000; MVCProject.ViewModels.EmployeeViewModel vmemp = new ViewModels.EmployeeViewModel(); vmemp.EmployeeName = emp.LastName + "" + emp.FirstName; if (emp.Salary > 10000) { vmemp.SalaryColor = "yellow"; } else { vmemp.SalaryColor = "green"; } return View("ViewModel", vmemp); }