public bool EditBusroute(Busroute busroute) { try { var bus = _transportDataAccess.SearchBusRouteById(busroute.Id); if (bus != null) { bus.Name = busroute.Name; bus.Description = busroute.Description; bus.LocationId = busroute.LocationId; bus.ModifiedDate = DateTime.UtcNow; bus.ModifiedBy = _username; var result = _transportDataAccess.EditBusroute(bus); var returnValue = result > 0 ? true : false; return(returnValue); } else { return(false); } } catch (Exception ex) { throw ex; } }
public IActionResult DeleteBusroute([FromBody] Busroute busroute) { try { var result = _transportBusiness.DeleteBusroute(busroute); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex)); } }
public bool AddBusroute(Busroute busroute) { try { var bus = new DbModel.BusRoute { Id = Guid.NewGuid(), Name = busroute.Name, Description = busroute.Description, LocationId = busroute.LocationId, StatusId = busroute.StatusId, CreatedDate = DateTime.UtcNow, CreatedBy = _username }; var result = _transportDataAccess.AddBusroute(bus); var returnValue = result > 0 ? true : false; return(returnValue); } catch (Exception ex) { throw ex; } }
public Busroute SearchBusroute(Busroute busroute) { try { var result = new DbModel.BusRoute(); if (busroute.Id != Guid.Empty) { result = _transportDataAccess.SearchBusRouteById(busroute.Id); } else if (!string.IsNullOrWhiteSpace(busroute.Name)) { result = _transportDataAccess.SearchBusRouteByName(busroute.Name); } else { result = null; } if (result != null) { var returnValue = new Busroute { Id = result.Id, Name = result.Name, Description = result.Description }; return(returnValue); } else { return(null); } } catch (Exception ex) { throw ex; } }
public bool DeleteBusroute(Busroute busroute) { try { var bus = _transportDataAccess.SearchBusRouteById(busroute.Id); if (bus != null) { bus.StatusId = Guid.Parse(Helper.Constants.INACTIVESTATUS); bus.ModifiedBy = _username; bus.ModifiedDate = DateTime.UtcNow; var result = _transportDataAccess.DeleteBusroute(bus); var returnValue = result > 0 ? true : false; return(returnValue); } else { return(false); } } catch (Exception ex) { throw ex; } }