public static int Add(ArticleInfo entity) { entity.Id = dal.Add(entity); UploadBLL.UpdateUpload(TableID, 0, entity.Id, Cookies.Admin.GetRandomNumber(false)); CacheHelper.Remove(cacheKey); return(entity.Id); }
public async Task <ArticleViewModel> Create(CreateArticleViewModel model, string hashUser) { var user = await _user.GetByHash(hashUser); var data = new Article(); data.IdUser = user.Id; data.PublishedDate = DateTime.Now; data.Text = model.Text; data.Title = model.Title; return(_mapper.Map <ArticleViewModel>(await _article.Add(data))); }
public object ArticleAdd() { var value = Request.Form.FirstOrDefault(c => c.Key == "DtoArticleParams").Value; if (String.IsNullOrEmpty(value)) { return(""); } var article = Newtonsoft.Json.JsonConvert.DeserializeObject <DtoArticleParams> (value); var file = Request.Form.Files[0]; if (file == null) { return(""); } using (var target = new MemoryStream()) { file.CopyToAsync(target); article.Img = target.ToArray(); } return(_Article.Add(article)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(TravelAgent.Model.Article model) { dal.Add(model); }