public async Task <IActionResult> Post([FromBody] PocMain pocMain) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { viewModel.PostDataToDB(pocMain); return(Ok(pocMain)); } catch (Exception) { throw; } }
/// <summary> /// Store data to database(General,DriveThru,FrontCounter,Kitchen) /// </summary> /// <param name="pocMain"></param> public void PostDataToDB(PocMain pocMain) { // spilt the data from pocMain object and store into specific tables gObj.Add(new GeneralModel() { Country = pocMain.Country, DayPart = pocMain.DayPart, DayPartVersion = pocMain.DayPartVersion }); dtObj.Add(new DriveThruModel() { DrinkMode = pocMain.DrinkMode, DTRemoteOT = pocMain.DTRemoteOT, DTtype = pocMain.DTtype }); fcObj.Add(new FrontCounterModel() { FCDrinkMode = pocMain.FCDrinkMode, FCRemoteOT = pocMain.FCRemoteOT, ServMode = pocMain.ServMode }); kObj.Add(new KitchenModel() { ArchDispenser = pocMain.ArchDispenser, FryerWall = pocMain.FryerWall, OperatingPlatform = pocMain.OperatingPlatform }); gObj.Save(); }