public async Task <IActionResult> AddOrUpdate([FromBody] DepoEventDtoUi model) { await CheckPermission(); _db.Connection.Execute(model.Id.HasValue ? Sql.SqlQueryCach["DepoEvents.Update"] : Sql.SqlQueryCach["DepoEvents.Insert"], model); return(Ok()); }
public async Task <IActionResult> GetById(int?id) { await CheckPermission(); DepoEventDtoUi model = new DepoEventDtoUi(); if (id.HasValue) { model = await _db.Connection.QueryFirstAsync <DepoEventDtoUi>(Sql.SqlQueryCach["DepoEvents.GetById"], new { id = id }); } model.DepoEventDataSource = await _commonService.GetDepoEventDataSource(); if (id.HasValue) { model.DepoEventDataSource.Inspections = await GetInspectionsSelectItem(model.TrainId); } return(Ok(model)); }