Ejemplo n.º 1
0
        private ObjComment MapComment(Comment model)
        {
            ObjComment result = new ObjComment();

            // заполняем стандартные даные
            result.Id        = model.Id;
            result.RootId    = model.RootId;
            result.RootType  = model.RootType;
            result.Text      = model.Text;
            result.Create    = model.Created;
            result.CreateStr = result.Create.ToString("dd.MM.yyyy HH:ss");
            result.CreatedId = model.CreateId;
            if (result.CreatedId.HasValue && result.CreatedId != 0)
            {
                var user = _userRepository.Get(result.CreatedId.Value);

                if (user != null)
                {
                    result.CreatedName     = user.Fio;
                    result.CreatedPhotoUrl = user.Id.ToString();
                }
            }
            //файлы
            //result.FilesList = _fileDataService.GetListFileDataLite(result.Id, FileRootType.Comment, model.RootType);
            return(result);
        }
Ejemplo n.º 2
0
        public IActionResult AddComment(ObjComment obj, int lastId = 0)
        {
            List <ObjFileData> files = new List <ObjFileData>();
            string             email = HttpContext.User.Identity.Name;

            obj.CreatedId = _userService.GetUserByEmail(HttpContext.User.Identity.Name).Id;
            _commentService.AddComment(obj, files);
            return(Json(_commentService.GetListComments(obj.RootId, obj.RootType, lastId)));
        }
Ejemplo n.º 3
0
        public ObjComment AddComment(ObjComment obj, List <ObjFileData> dataList)
        {
            var Comment = new Comment
            {
                Created  = DateTime.Now,
                CreateId = obj.CreatedId,
                RootId   = obj.RootId,
                Text     = obj.Text,
                RootType = obj.RootType,
            };

            _commentRepository.Insert(Comment);
            _commentRepository.SaveChanges();

            return(new ObjComment());
        }