Beispiel #1
0
 public IActionResult AddNewHoliday([FromBody] NewPublicHoliday NewHoliday)
 {
     if (ModelState.IsValid)
     {
         NewPublicHoliday tablePH = new NewPublicHoliday();
         tablePH.PublicHolidayId   = Guid.NewGuid();
         tablePH.PublicHolidayDate = NewHoliday.PublicHolidayDate;
         //tablePH.PublicHolidayName = NewHoliday.PublicHolidayName;
         tablePH.StartDate   = NewHoliday.StartDate;
         tablePH.EndDate     = NewHoliday.EndDate;
         tablePH.IsActive    = NewHoliday.IsActive;
         tablePH.CreatedDate = NewHoliday.CreatedDate;
         tablePH.CreatedBy   = NewHoliday.CreatedBy;
         tablePH.UpdatedDate = NewHoliday.UpdatedDate;
         _dataAccessProvider.AddNewHoliday(tablePH);
         return(Ok());               //return successfully added
     }
     return(BadRequest(ModelState)); // if ModelState not valid, show error message
 }