public ActionResult Add(Editor edtr, HttpPostedFileBase file) { EditorRepository editorAdd = new EditorRepository(); edtr.CreateDate = DateTime.Now; edtr.ImageId = AddNewsImage(file); editorAdd.Add(edtr); return(RedirectToAction("EditorList")); }
public ActionResult AddEditor(Editor item, HttpPostedFileBase resim) { if (col_repo.Any(x => x.UserName == item.UserName || x.Email == item.Email) || editor_repo.Any(x => x.UserName == item.UserName || x.Email == item.Email) || app_repo.Any(x => x.UserName == item.UserName || x.Email == item.Email)) { ViewBag.Mevcut = "Böyle bir kullanıcı mevcut"; return(View()); } if (item.ImagePath != null) { item.ImagePath = ImageUploader.UploadImage("~/Pictures", resim); } item.CreatedBy = (Session["admin"] as AppUser).UserName; item.Password = Crypto.HashPassword(item.Password); editor_repo.Add(item); return(RedirectToAction("ListEditor")); }