Пример #1
0
        public Suggest Publish(DTOSuggestModel dTOSuggestModel)
        {
            Suggest suggest = Mapper.Map <DTOSuggestModel, Suggest>(dTOSuggestModel);

            suggest.Publish();
            return(_suggestReporsitory.Save(suggest));

            //_suggest = new Suggest();
            //_suggest.Title = title;
            //_suggest.Body = body;
            //_suggest.Author = _userReporsitory.GetByName(userModel.UserName);
            //_suggestReporsitory.Save(_suggest);
            //return _suggest;
        }
Пример #2
0
        private static BLL.Suggest publish(string title, string body, User author)
        {
            SuggestReporsitory suggestReporsitory = new SuggestReporsitory(Helper.Context);

            BLL.Suggest suggest = new BLL.Suggest
            {
                Title  = title,
                Body   = body,
                Author = author
            };
            suggestReporsitory.Save(suggest);

            BLL.Message message = new BLL.Message
            {
                PublishTime = DateTime.Now,
                Owner       = author
            };
            MessageReporsitory messageReporsitory = new MessageReporsitory(Helper.Context);

            messageReporsitory.Save(message);

            return(suggest);
        }