public DataResponse Add(Blog entity) { var blog = _blogDal.Add(entity); if (blog == null) { return new DataResponse { Mesaj = "Blog Eklenemedi", Tamamlandi = false, } } ; return(new DataResponse { Data = blog, Tamamlandi = true, Mesaj = blog.Baslik + " Baslikli Blog Eklendi", }); }
public async Task <IActionResult> Create(Blog blog, IFormFile file) { if (file?.Length > 5000000) { ModelState.AddModelError(ConstStrings.FileSize, ConstStrings.FileLimit); } if (file != null && !file.ContentType.Contains(ConstStrings.Image)) { ModelState.AddModelError(ConstStrings.WrongType, ConstStrings.ImageError); } if (ModelState.IsValid) { if (file != null) { await UploadImage(blog, file); } else { blog.Image = "dummy.jpg"; blog.ImageThumb = "dummy_thumb.jpg"; } if (string.IsNullOrWhiteSpace(blog.Body)) { blog.Body = ConstStrings.NonBodyInArticle; } blog.Date = DateTime.Now; _blogDal.Add(blog); return(RedirectToAction("List", "Blogs")); } ViewBag.Categories = new SelectList(_categoryDal.GetList(), "Id", "Name"); return(View(blog)); }
public void Add(Blog blog) { _blogDal.Add(blog); }
public void Add(Blog entity) { _blogDal.Add(entity); }
public Blog Add(Blog blog) { return(_blogDal.Add(blog)); }
public IResult Add(Blog entity) { _blogDal.Add(entity); return(new SuccessResult()); }