public ActionResult EmployeeLeaveAssign(FormCollection formCollection, String[] employees, String[] balDays, string[] newDays, String[] remarks) //string entities ) { if (employees.Length > 0) { List <Entities.EmployeeLeaveTransaction> entities = new List <Entities.EmployeeLeaveTransaction>(); Entities.EmployeeLeaveTransaction entity; for (int i = 0; i < employees.Length; i++) { entity = new Entities.EmployeeLeaveTransaction(); int id = 0; if (employees[i] != null) { int.TryParse(employees[i], out id); } entity.EmployeeId = id; decimal newDays1 = 0; if (newDays[i] != null) { decimal.TryParse(newDays[i], out newDays1); } entity.LeavesInDays = newDays1; decimal balanceDays = 0; if (balDays[i] != null) { decimal.TryParse(balDays[i], out balanceDays); } entity.BalanceLeaves = balanceDays + newDays1; string remark = string.Empty; if (remarks[i] != null) { remark = Convert.ToString(remarks[i]); } entity.Remark = remark; entities.Add(entity); } EmployeeBAL employeeBAL = new EmployeeBAL(); employeeBAL.addLeaves(entities); //EmployeeLeaveAssignVM viewModel = new EmployeeLeaveAssignVM(); TempData["Message"] = "Successfully Submitted."; // return View(viewModel); } else { //EmployeeLeaveAssignVM viewModel = new EmployeeLeaveAssignVM(); TempData["Error"] = "Something wrong, Records not valid."; // return View(viewModel); } return(View()); }