Esempio n. 1
0
        public async Task <ResponceModel> GetAll([FromRoute] int postId)
        {
            try
            {
                var postComments = await _postCommentService.GetAll(postId);

                return(new ResponceModel(200, "OK", postComments, null));
            }
            catch (Exception ex)
            {
                await _logService.Add(new SystemLog()
                {
                    Content = ex.Message, CreateDate = DateTime.Now, UserId = 0, EntityName = _postCommentService.GetType().Name
                });

                return(new ResponceModel(500, "ERROR", null, new string[] { "Veriler getirilirken bir sorun oluştu." }));
            }
        }
Esempio n. 2
0
        public DashboardModel GetResponses()
        {
            var model = new DashboardModel()
            {
                Labels = new List <string>(),
                Datas  = new List <int>()
            };

            var list = PostCommentService.GetAll();
            var date = DateTime.Now.AddDays(-6);
            int i    = 1;

            for (var d = date; i <= 7; d = d.AddDays(1), i++)
            {
                model.Labels.Add(d.ToString("ddd,dd"));
                model.Datas.Add(list.Count(l => l.COMMENTDATE.Day == d.Day));
            }

            return(model);
        }
 public List <PostComment> GetAll()
 {
     return(PostCommentService.GetAll());
 }