public async Task <ActionResult <Table_TableDTO> > Get([FromBody] Table_TableDTO Table_TableDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } Table Table = await TableService.Get(Table_TableDTO.Id); return(new Table_TableDTO(Table)); }
public async Task <ActionResult <Table_TableDTO> > Create([FromBody] Table_TableDTO Table_TableDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } Table Table = ConvertDTOToEntity(Table_TableDTO); Table = await TableService.Create(Table); Table_TableDTO = new Table_TableDTO(Table); if (Table.IsValidated) { return(Table_TableDTO); } else { return(BadRequest(Table_TableDTO)); } }
private Table ConvertDTOToEntity(Table_TableDTO Table_TableDTO) { Table Table = new Table(); Table.Id = Table_TableDTO.Id; Table.Code = Table_TableDTO.Code; Table.OrderId = Table_TableDTO.OrderId; Table.Order = Table_TableDTO.Order == null ? null : new Order { Id = Table_TableDTO.Order.Id, Code = Table_TableDTO.Order.Code, OrderDate = Table_TableDTO.Order.OrderDate, PayDate = Table_TableDTO.Order.PayDate, AccountId = Table_TableDTO.Order.AccountId, NumOfTable = Table_TableDTO.Order.NumOfTable, NumOfPerson = Table_TableDTO.Order.NumOfPerson, Descreption = Table_TableDTO.Order.Descreption, StatusId = Table_TableDTO.Order.StatusId, }; Table.BaseLanguage = CurrentContext.Language; return(Table); }