public async Task <JsonResult> Insert(HolidayVM vm) { try { var list = _holidayService.GetAll(); list = HolidayUtility.FilterByCompanyID(CurrentUser.CompanyID, list); //verify if conflict with other holidays vm.ID = Guid.NewGuid().ToString(); vm.Company = new CompanyViewModel() { ID = CurrentUser.CompanyID }; var model = HolidayUtility.VMToM(vm); _holidayService.Insert(model); return(Json(new { success = true })); } catch { return(Json(new { success = false })); } }
// POST: api/Holidays public void Post(HolidayParam holidayParam) { _holidayService.Insert(holidayParam); }