public ActionResult Index(List<TestAllocation> lstTestAllocations)
        {
            fillDropDownList();
            try
            {

                List<string> errorMessage = new List<string>();
                foreach (var item in lstTestAllocations)
                {
                    //if (TestAllocationService.FindBy(p => p.SRID.Trim() == item.SRID.Trim()).Count() > 0)
                    //{
                    //    errorMessage.Add("Tests already allocated to this sample");
                    //}
                    if (item.testAllocationUserGroup == null)
                    {
                        errorMessage.Add("Please allocate atleast(1) user group to test");
                    }
                    if (errorMessage.Count() != 0)
                    {
                        return Json(new { errorMessage });
                    }
                    else
                    {
                        TestAllocationService.Create(item);
                    }

                }
                return View();
            }
            catch
            {
                TestAllocationViewModel objTestAllocationViewModel = new TestAllocationViewModel();
                objTestAllocationViewModel.lstTestAllocation = lstTestAllocations;
                return PartialView("~/Views/PartialView/testAllocation.cshtml", objTestAllocationViewModel);
            }
        }
 public ActionResult RenderView(string SRID)
 {
     fillDropDownList();
     List<TestAllocation> lstTestAllocation = new List<TestAllocation>();
     SampleReceive sampleReceive = SampleReceivingService.GetBySRID(SRID);
     ViewBag.NoOfTestRequired = sampleReceive.NoOfTestRequired;
     for (int i = 0; i < sampleReceive.NoOfTestRequired; i++)
     {
         lstTestAllocation.Add(new TestAllocation() { TestName = sampleReceive.lstSampleTest[i].test.TestName, TargetDate = DateTime.Now, TestID = sampleReceive.lstSampleTest[i].test.TestID, SampleReceiveID = sampleReceive.SampleReceiveID ,SRID= sampleReceive.SRID});
     }
     TestAllocationViewModel objTestAllocationViewModel = new TestAllocationViewModel();
     objTestAllocationViewModel.lstTestAllocation = lstTestAllocation;
     return PartialView("~/Views/PartialView/testAllocation.cshtml", objTestAllocationViewModel);
 }