public ActionResult Create([Bind(Include = "id,CalStartMonth,WeekendStartDay,WeekendEndDay,BusinessunitId,DepartmentId,HrId,HoursDay,IsHalfday,IsLeaveTransfer,IsSkipHolidays,Descriptions,Isactive")] LeaveManagementViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             LeaveManagement leave = new LeaveManagement();
             leave.CalStartMonth   = model.CalStartMonth.Value.ToString();
             leave.businessunitId  = model.businessunitId;
             leave.WeekendStartDay = model.WeekendStartDay.Value.ToString();
             leave.WeekendEndDay   = model.WeekendEndDay.Value.ToString();
             leave.IsSkipHolidays  = model.IsSkipHolidays;
             leave.IsLeaveTransfer = model.IsLeaveTransfer;
             leave.departmentId    = model.departmentId;
             leave.Descriptions    = model.Descriptions;
             leave.HoursDay        = model.HoursDay.Value.ToString();
             leave.HrId            = model.HrId;
             leave.createdby       = User.Identity.GetUserId();
             leave.modifiedby      = User.Identity.GetUserId();
             leave.Isactive        = true;
             leaveRepo.AddLeaveManagement(leave);
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     ViewBag.businessUnits = new SelectList(BunitsRepo.GetBusinessUnit().OrderBy(x => x.BusId), "BusId", "unitname", "BusId");
     ViewBag.Months        = new SelectList(Apimanager.GetAllMonths().OrderBy(x => x.id), "MonthId", "MonthName", "MonthId");
     ViewBag.weekDays      = new SelectList(Apimanager.GetWeekDays().OrderByDescending(x => x.id), "id", "DayLongCode", "id");
     return(View(model));
 }
 public ActionResult Create()
 {
     ViewBag.businessUnits = new SelectList(BunitsRepo.GetBusinessUnit().OrderBy(x => x.BusId), "BusId", "unitname", "BusId");
     ViewBag.Months        = new SelectList(Apimanager.GetAllMonths().OrderBy(x => x.id), "MonthId", "MonthName", "MonthId");
     ViewBag.weekDays      = new SelectList(Apimanager.GetWeekDays().OrderByDescending(x => x.id), "id", "DayLongCode", "id");
     return(View());
 }