public virtual void Add(StaffDetailBO staffDetail)
 {
     if (staffDetail == null)
     {
         throw new ArgumentNullException("staffdetail", "Staff Detail is Null");
     }
     else
     {
         db.staffDetailRepository.Add(staffDetail);
         unitofWork.Commit();
     }
 }
        public ActionResult Import(HttpPostedFileBase excelfile)
        {
            if (excelfile.ContentLength == 0 || excelfile == null)
            {
                return(View());
            }
            else
            {
                if (excelfile.FileName.EndsWith("xls") || excelfile.FileName.EndsWith("xlsx"))
                {
                    string name = Path.GetFileName(excelfile.FileName);
                    string path = Server.MapPath("~/Content/" + name);
                    if (System.IO.File.Exists(path))
                    {
                        System.IO.File.Delete(path);
                    }
                    excelfile.SaveAs(path);

                    //List<StaffTableViewModel> StaffList = new List<StaffTableViewModel>();

                    //read from excel file...
                    Excel.Application application = new Excel.Application();
                    Excel.Workbook    workbook    = application.Workbooks.Open(path);
                    Excel.Worksheet   worksheet   = workbook.ActiveSheet;
                    Excel.Range       range       = worksheet.UsedRange;

                    for (int row = 7; row <= 44; row++)
                    {
                        //Change Rows and Column Details
                        StaffDetailBO staff = new StaffDetailBO();
                        staff.StaffID        = ((Excel.Range)range.Cells[row, 1]).Text;
                        staff.FullName       = ((Excel.Range)range.Cells[row, 2]).Text;
                        staff.Department     = ((Excel.Range)range.Cells[row, 7]).Text;
                        staff.Email          = ((Excel.Range)range.Cells[row, 10]).Text;
                        staff.Supervisor     = ((Excel.Range)range.Cells[row, 14]).Text;
                        staff.JobDescription = ((Excel.Range)range.Cells[row, 13]).Text;
                        staff.Status         = ((Excel.Range)range.Cells[row, 17]).Text;
                        staff.OrganizationID = CurrentOrganizationId;
                        //context.StaffTable.Add(staff);
                        zeus.staffManager.Add(staff);
                    }
                    //context.SaveChanges();
                    //ViewBag.StaffList = StaffList;
                    ViewBag.Success = "Import Successful";
                    return(View());
                }
                else
                {
                    return(View());
                }
            }
        }