Esempio n. 1
0
        public void Execute(IJobExecutionContext context)
        {
            using (OnlineMusicEntities db = new OnlineMusicEntities())
            {
                try
                {
                    db.UpdateSongRanking(DateTime.Now.Date);
                    Log("Updated song ranking");
                }
                catch (Exception e)
                {
                    Log("Failed to update song ranking: " + e.InnerException?.Message);
                }

                try
                {
                    db.UpdateAlbumRanking(DateTime.Now.Date);
                    Log("Updated album ranking");
                }
                catch (Exception e)
                {
                    Log("Failed to update album ranking: " + e.InnerException?.Message);
                }
            }
        }
Esempio n. 2
0
 public HttpResponseMessage UpdateRanking([FromUri] int year, [FromUri] int month, [FromUri] int day)
 {
     using (var db = new OnlineMusicEntities())
     {
         try
         {
             DateTime updateDate = new DateTime(year, month, day);
             db.UpdateAlbumRanking(updateDate);
             return(Request.CreateResponse(HttpStatusCode.OK));
         }
         catch (Exception e)
         {
             return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message));
         }
     }
 }