Exemplo n.º 1
0
 internal bool EditMatch(int stadiumID, int hostID, int guestID, int mainRefereeID, int technicalRefereeID, int linearRefereeID, int observerRefereeID, int hostGoals, int guestGoals, int currentMatchID)
 {
     try
     {
         using (dbEntities1 context = new dbEntities1())
         {
             Match match = context.Match.FirstOrDefault(x => x.id == currentMatchID);
             match.stadiumID            = stadiumID;
             match.hostID               = hostID;
             match.guestID              = guestID;
             match.mainRefereeID        = mainRefereeID;
             match.technicalRefereeID   = technicalRefereeID;
             match.linesRefereeID       = linearRefereeID;
             match.observerRefereeID    = observerRefereeID;
             match.hostGoals            = hostGoals;
             match.guestGoals           = guestGoals;
             context.Entry(match).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> PutTweet(int id, Tweet tweet)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tweet.tweetId)
            {
                return(BadRequest());
            }

            db.Entry(tweet).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TweetExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
 internal bool EditTimetable(int matchID, int refereeID, long currentTimetableID)
 {
     try
     {
         using (dbEntities1 context = new dbEntities1())
         {
             Timetable timetable = context.Timetable.FirstOrDefault(x => x.id == currentTimetableID);
             timetable.matchID              = matchID;
             timetable.refereeID            = refereeID;
             context.Entry(timetable).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 4
0
 internal bool EditTicket(int matchID, string pESEL, long currentTicketID)
 {
     try
     {
         using (dbEntities1 context = new dbEntities1())
         {
             Ticket ticket = context.Ticket.FirstOrDefault(x => x.id == currentTicketID);
             ticket.matchID = matchID;
             ticket.PESEL   = pESEL;
             context.Entry(ticket).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 5
0
 internal bool EditRecord(string newType, string newName, long currentRecordID)
 {
     try
     {
         using (dbEntities1 context = new dbEntities1())
         {
             Record record = context.Record.FirstOrDefault(x => x.id == currentRecordID);
             record.type = newType;
             record.name = newName;
             context.Entry(record).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 6
0
 internal bool EditPlayer(string firstName, string lastName, int clubID, int recordID, int playerID)
 {
     try
     {
         using (dbEntities1 context = new dbEntities1())
         {
             Player player = context.Player.FirstOrDefault(x => x.id == playerID);
             player.firstName            = firstName;
             player.lastName             = lastName;
             player.clubID               = clubID;
             player.recordID             = recordID;
             context.Entry(player).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 7
0
 internal bool EditReferee(string firstName, string lastName, double salary, int recordID, int iD)
 {
     try
     {
         using (dbEntities1 context = new dbEntities1())
         {
             Referee referee = context.Referee.FirstOrDefault(x => x.id == iD);
             referee.firstName            = firstName;
             referee.lastName             = lastName;
             referee.salary               = salary;
             referee.recordID             = recordID;
             context.Entry(referee).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 8
0
 internal bool EditStaff(string firstName, string lastName, int clubID, int staffID, int age, string duty)
 {
     try
     {
         using (dbEntities1 context = new dbEntities1())
         {
             TrainingStaff staff = context.TrainingStaff.FirstOrDefault(x => x.id == staffID);
             staff.firstName            = firstName;
             staff.lastName             = lastName;
             staff.clubID               = clubID;
             staff.age                  = age;
             staff.duty                 = duty;
             context.Entry(staff).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 9
0
 internal bool EditWinners(int clubID, string year, int wonMatches, int lostMatches, int goalsScored, int goalsLost, int winnersID)
 {
     try
     {
         using (dbEntities1 context = new dbEntities1())
         {
             Winners winners = context.Winners.FirstOrDefault(x => x.id == winnersID);
             winners.goalsScored          = goalsScored;
             winners.goalsLost            = goalsLost;
             winners.lostMatches          = lostMatches;
             winners.clubID               = clubID;
             winners.wonMatches           = wonMatches;
             winners.lostMatches          = lostMatches;
             winners.year                 = year;
             context.Entry(winners).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }