Ejemplo n.º 1
0
 public async Task <bool> AddProvinceAsync(Province province)
 {
     return(await _template.ExecuteAsync(
                "insert into province (name) values (@name)",
                new[] { new QueryParameter("@name", province.Name) }
                ) == 1);
 }
Ejemplo n.º 2
0
 public async Task <bool> UpdateAsync(SeatCategory item)
 {
     return(await adoTemplate.ExecuteAsync(@"UPDATE SeatCategory
                                             SET CategoryName = @CName , Price = @Price
                                             WHERE SeatCategoryId = @SCId",
                                           new QueryParameter("@CName", item.CategoryName),
                                           new QueryParameter("@Price", item.Price),
                                           new QueryParameter("@SCId", item.SeatCategoryId)) == 1);
 }
Ejemplo n.º 3
0
 public async Task <bool> UpdateAllAsync(StationType stationType)
 {
     return(await _template.ExecuteAsync(
                "UPDATE station_type SET manufacturer = @manufacturer, model = @model WHERE id = @id",
                new[] {
         new QueryParameter("@manufacturer", stationType.Manufacturer),
         new QueryParameter("@model", stationType.Model),
         new QueryParameter("@id", stationType.Id)
     }) == 1);
 }
Ejemplo n.º 4
0
 public async Task <bool> UpdateAsync(Schedule item)
 {
     return(await adoTemplate.ExecuteAsync(@"UPDATE Schedule
                                             SET CinemaHallId = @CId, MovieId = @MId, StartTime = @ST " +
                                           "WHERE ScheduleId = @SId",
                                           new QueryParameter(@"@SId", item.ScheduleId),
                                           new QueryParameter(@"@CId", item.CinemaHall.CinemaHallId),
                                           new QueryParameter(@"@MId", item.Movie.MovieId),
                                           new QueryParameter(@"@ST", item.StartTime)) == 1);
 }
Ejemplo n.º 5
0
 public async Task <bool> AddUnitAsync(Unit unit)
 {
     return(await _template.ExecuteAsync(
                "insert into unit (short_name, long_name) values (@short_name, @long_name)",
                new[] {
         new QueryParameter("@short_name", unit.ShortName),
         new QueryParameter("@long_name", unit.LongName),
     }
                ) == 1);
 }
Ejemplo n.º 6
0
 public async Task <bool> AddDistrictAsync(District district)
 {
     return(await _template.ExecuteAsync(
                "insert into district (name, province_id) values (@name, @province_id)",
                new[] {
         new QueryParameter("@name", district.Name),
         new QueryParameter("@province_id", district.ProvinceId)
     }
                ) == 1);
 }
Ejemplo n.º 7
0
 public async Task <bool> AddMeasurementTypeAsync(MeasurementType measurementType)
 {
     return(await _template.ExecuteAsync(
                "INSERT INTO measurement_type (name) VALUES (@name)",
                new[]
     {
         new QueryParameter("name", measurementType.Name)
     }
                ) == 1);
 }
Ejemplo n.º 8
0
 public async Task <bool> AddCommunityAsync(Community community)
 {
     return(await _template.ExecuteAsync(
                "insert into community (zip_code, name, district_id) values (@zip_code, @name, @district_id)",
                new[] {
         new QueryParameter("@zip_code", community.ZipCode),
         new QueryParameter("@name", community.Name),
         new QueryParameter("@district_id", community.DistrictId)
     }
                ) == 1);
 }
Ejemplo n.º 9
0
 public async Task <bool> UpdateAsync(Movie item)
 {
     return(await adoTemplate.ExecuteAsync(@"UPDATE Movie
                                             SET Titel=@Titel, Description=@Desc, Playtime=@Playtime, Poster=@Poster, Link=@Link, Archived=@Archived
                                             WHERE MovieId = @MId",
                                           new QueryParameter("@MId", item.MovieId),
                                           new QueryParameter("@Titel", item.Titel),
                                           new QueryParameter("@Desc", item.Description),
                                           new QueryParameter("@Playtime", item.Playtime),
                                           new QueryParameter("@Poster", item.Poster),
                                           new QueryParameter("@Link", item.Link),
                                           new QueryParameter("@Archived", item.Archived)) == 1);
 }
Ejemplo n.º 10
0
 public async Task <bool> AddMeasurementAsync(Measurement measurement)
 {
     return(await _template.ExecuteAsync(
                "INSERT INTO measurement (value, type_id, timestamp, station_id, unit_id) VALUES " +
                "(@value, @type_id, @timestamp, @station_id, @unit_id)",
                new[] {
         new QueryParameter("@value", measurement.Value),
         new QueryParameter("@type_id", measurement.TypeId),
         new QueryParameter("@timestamp", measurement.Timestamp),
         new QueryParameter("@station_id", measurement.StationId),
         new QueryParameter("@unit_id", measurement.UnitId)
     }
                ) == 1);
 }
Ejemplo n.º 11
0
 public async Task <bool> UpdateAllAsync(Station station)
 {
     return(await _template.ExecuteAsync("UPDATE station SET name = @name, type_id = @type_id, latitude = @latitude, longitude = @longitude, community_id = @community_id, altitude = @altitude, creator = @creator WHERE id = @id",
                                         new[] {
         new QueryParameter("@name", station.Name),
         new QueryParameter("@type_id", station.TypeId),
         new QueryParameter("@latitude", station.Latitude),
         new QueryParameter("@longitude", station.Longitude),
         new QueryParameter("@community_id", station.CommunityId),
         new QueryParameter("@altitude", station.Altitude),
         new QueryParameter("@creator", station.Creator),
         new QueryParameter("@id", station.Id)
     }) == 1);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Updates an existing user. NO hashing on password of user object.
 /// </summary>
 /// <param name="user">DO NOT USE FOR PASSWORD UPDATE</param>
 /// <returns>Returns true if the update was successful</returns>
 public async Task <bool> UpdateAllAsync(User user)
 {
     return(await _template.ExecuteAsync(
                "UPDATE user SET username = @username, password = @password, email = @email, first_name = @firstname, last_name = @lastname, date_of_birth = @dob, community_id = @community_id WHERE id = @id",
                new[] {
         new QueryParameter("@username", user.Username),
         new QueryParameter("@password", user.Password),
         new QueryParameter("@email", user.Email),
         new QueryParameter("@firstname", user.FirstName),
         new QueryParameter("@lastname", user.LastName),
         new QueryParameter("@dob", user.DateOfBirth),
         new QueryParameter("@community_id", user.CommunityId),
         new QueryParameter("@id", user.Id)
     }) == 1);
 }
Ejemplo n.º 13
0
 public async Task <bool> DeleteAsync(Actor a)
 {
     return(await adoTemplate.ExecuteAsync(@"DELETE FROM Actor WHERE ActorId = @AId",
                                           new QueryParameter("@AId", a.ActorId)) == 1);
 }
Ejemplo n.º 14
0
 public async Task <bool> DeleteAsync(CinemaHall item)
 {
     return(await adoTemplate.ExecuteAsync(@"DELETE FROM CinemaHall WHERE CinemaHallId = @CId",
                                           new QueryParameter(@"@CId", item.CinemaHallId)) == 1);
 }
Ejemplo n.º 15
0
 public async Task <bool> DeleteAsync(int id)
 {
     return(await adoTemplate.ExecuteAsync(@"DELETE FROM Reservation WHERE ReservationId = @RId",
                                           new QueryParameter("@RId", id)) == 1);
 }