public string Rating(int? id, int? score)
        {
            Article a = null;
            int Uid = Autorizacija.Autorizacija.GetCurrentUser(this.HttpContext).UserID;
            string rating = "";
            if (id.HasValue && score.HasValue)
            {
                using (DBBL Baza = new DBBL())
                {

                    ArticlesRating ar = new ArticlesRating()
                    {
                        ArticlesID = id.Value,
                        UserID = Uid,
                        GUID = Guid.NewGuid(),
                        DateRating = DateTime.Now,
                        Score = score
                    };
                    try
                    {
                        Baza.AddRating(ar);
                    }
                    catch (Exception)
                    {

                        return "False";
                    }

                    a = Baza.GetWikiByID(id.Value);
                    int suma = 0;
                    foreach (var rat in a.ArticlesRatings.ToList())
                    {
                        suma += rat.Score.Value;
                    }
                    rating = (suma / a.ArticlesRatings.Count).ToString();
                }

            }
            return rating;
        }
 public void AddRating(ArticlesRating ar)
 {
     string cmd = string.Format("EXEC [dbo].[usp_ArticlesRatingInsert] {0},{1},'{2}',null,'{3}',{4}", ar.ArticlesID, ar.UserID, ar.DateRating.Value.ToString("MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture), ar.GUID, ar.Score);
     context.Database.ExecuteSqlCommand(cmd);
 }