public bool UpdateStatus(Chore chore, string sessionid) { HouseManagerServer.Chore ch = dBChore.GetChoreById(chore.Id); HouseManagerServer.Person person = dBSession.GetSessionBySessionID(sessionid).Person; if (ch.Person != null && ch.Person.Id == person.Id) { return(dBChore.UpdateChoreStatus(new HouseManagerServer.Chore { Id = chore.Id, Status = chore.Status })); } else { return(false); } }
public bool JoinChore(Chore chore, string sessionid) { lock (dBChore) { HouseManagerServer.Chore ch = dBChore.GetChoreById(chore.Id); if (ch.Person == null) { int personid = dBSession.GetSessionBySessionID(sessionid).Person.Id; return(dBChore.AssignPersonToChoreById(chore.Id, personid)); } else { return(false); } } }
public bool UpdateChoreStatus(Chore chore) { string sql = "update Chore set status = @status where id = @id"; command = DBConnection.GetDbConn().CreateCommand(); command.CommandText = sql; command.Parameters.Clear(); SqlParameter idParam = new SqlParameter("@id", SqlDbType.Int); idParam.Value = chore.Id; SqlParameter statusParam = new SqlParameter("@status", SqlDbType.TinyInt); statusParam.Value = chore.Status; command.Parameters.Add(idParam); command.Parameters.Add(statusParam); command.ExecuteNonQuery(); return(true); }