public ActionResult Create(TableCmdViewModel TableCmdViewModel) { if (!ModelState.IsValid) { return(View()); } try { //TableCmd tableCmd = new TableCmd(); //tableCmd.ID = TableCmdViewModel.ID; //tableCmd.Number = TableCmdViewModel.Number; //tableCmd.NumberOfPlace = TableCmdViewModel.NumberOfPlace; //tableCmd.Occupation = TableCmdViewModel.Occupation; //tableCmd.Place = TableCmdViewModel.Place; //tableCmd.ServeurId = TableCmdViewModel.ServeurId; var tableCmd = _mapper.Map <TableCmd>(TableCmdViewModel); _TableCmdRepository.Add(tableCmd); _TableCmdRepository.Save(); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Create(TableCmdViewModel tableCmd) { try { //TableCmd tbl = new TableCmd(); //tbl.Id = tableCmd.Id; //tbl.Numero = tableCmd.Numero; //tbl.NbPlace = tableCmd.NbPlace; //tbl.Occupation = tableCmd.Occupation; //tbl.Emplacement = tableCmd.Emplacement; //tbl.ServeurId = tableCmd.ServeurId; var tbl = _mappper.Map <TableCmd>(tableCmd); _tableCmdRepository.Insert(tbl); _tableCmdRepository.Save(); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }