public async Task <IActionResult> PostBlog1([FromBody] Blog1 blog1) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Blog1.Add(blog1); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (Blog1Exists(blog1.BlogId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetBlog1", new { id = blog1.BlogId }, blog1)); }
public IActionResult Test2() { //Blog1.Update(4, "AAAAA", "BBBBBB"); long result = Blog1.TestProc(); return(Content(result.ToString())); }
public async Task <IActionResult> PutBlog1([FromRoute] int id, [FromBody] Blog1 blog1) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != blog1.BlogId) { return(BadRequest()); } _context.Entry(blog1).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Blog1Exists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult Edit(long id) { ViewBag.PageName = "Edit"; Blog1 blog = Blog1.Read(id); ViewBag.id = blog.id; ViewBag.title = blog.title; ViewBag.paragraphs = blog.paragraphs; return(View("Add")); }
public IActionResult SaveNew(long id, string title, string paragraphs) { if (id >= 1) { Blog1.Update(id, title, paragraphs); } else { Blog1.Create(title, paragraphs); } ViewBag.Message = "Your entry has been saved."; List <Blog1> blogs = Blog1.Read(); return(View("Test", blogs)); }
public ActionResult Register(RegisterLog model, RegisterLog formData) { Blog1 kayit = new Blog1(); kayit.Number = model.Number; kayit.Name = model.Name; kayit.Surname = model.SurName; kayit.Password = model.Password; db.Blog1.Add(kayit); db.SaveChanges(); if (!ModelState.IsValid) { return(View(formData)); } return(Content("Name : " + formData.Name + "E - Mail :" + formData.Email)); }
public ActionResult Login(AuthLogin formData, string returnUrl, AuthLogin data) { blogEntities4 db = new blogEntities4(); Blog1 kayit = new Blog1(); string name, surname, pass; Boolean cafer = false; if (!ModelState.IsValid) { return(View()); } else { foreach (var err in db.Blog1) { name = err.Name; surname = err.Surname; pass = err.Password; if (name == data.Username && pass == data.Password) { FormsAuthentication.SetAuthCookie(err.Name, true); cafer = true; } } } if (cafer == false) { return(View("Hata")); } if (!String.IsNullOrWhiteSpace(returnUrl)) { return(Redirect(returnUrl)); } return(RedirectToRoute("Home")); }
public IActionResult Test(string search) { List <Blog1> blogs = Blog1.Read(search); return(View(blogs)); }
public IActionResult Blog(long id) { Blog1 blog = Blog1.Read(id); return(View(blog)); }