public ActionResult DeleteConfirmed(int id) { WhatWeDo whatWeDo = db.WhatWeDos.Find(id); db.WhatWeDos.Remove(whatWeDo); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <IActionResult> DeletePost(int?id) { WhatWeDo skill = await _context.WhatWeDos.FindAsync(id); _context.WhatWeDos.Remove(skill); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public ActionResult Edit([Bind(Include = "Id,Title,Description,ImageURL")] WhatWeDo whatWeDo) { if (ModelState.IsValid) { db.Entry(whatWeDo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(whatWeDo)); }
public ActionResult Create([Bind(Include = "Id,Title,Description,ImageURL")] WhatWeDo whatWeDo) { if (ModelState.IsValid) { db.WhatWeDos.Add(whatWeDo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(whatWeDo)); }
public async Task <IActionResult> Create(WhatWeDo skilll) { if (!ModelState.IsValid) { return(View()); } await _context.WhatWeDos.AddAsync(skilll); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); //return Content($"title-{skilll.Title} description-{skilll.Description}"); }
public async Task <IActionResult> Create(WhatWeDo skill) { if (!ModelState.IsValid) { return(View()); } await _context.WhatWeDos.AddAsync(skill); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Delete(int?id) { if (id == null) { return(NotFound()); } WhatWeDo skill = await _context.WhatWeDos.FindAsync(id); if (skill == null) { return(NotFound()); } return(View(skill)); }
public async Task <IActionResult> Create(WhatWeDo skill) { if (!ModelState.IsValid) { return(View()); } await _dbPolo.WhatWeDos.AddAsync(skill); await _dbPolo.SaveChangesAsync(); //return Content($"title {skill.Title}description {skill.Description}"); return(RedirectToAction(nameof(Index))); //Bu yazilisda ModelBainting-de View mutleq model isteyir. }
// GET: Admin/WhatWeDoes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WhatWeDo whatWeDo = db.WhatWeDos.Find(id); if (whatWeDo == null) { return(HttpNotFound()); } return(View(whatWeDo)); }
public bool Delete(WhatWeDoDTO obj) { try { WhatWeDo data = _db.WhatWeDos.Find(obj.Id); _db.WhatWeDos.Remove(data); _db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Update(WhatWeDoDTO obj, int Id) { try { WhatWeDo data = _db.WhatWeDos.Find(Id); data.Content = obj.Content; data.LanguageId = obj.LanguageId; _db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public async Task <IActionResult> Update(int?id, WhatWeDo skill) { // WhatWeDo dbskill = await _dbPolo.WhatWeDos.FindAsync(id); if (!ModelState.IsValid) { return(View()); } //dbskill.Title = skill.Title; //dbskill.Description = skill.Description; //await _dbPolo.SaveChangesAsync(); _dbPolo.Entry(skill).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _dbPolo.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public WhatWeDoDTO Get(int Id) { try { WhatWeDo data = _db.WhatWeDos.Find(Id); WhatWeDoDTO finaldata = new WhatWeDoDTO { Id = data.Id, Content = data.Content, LanguageId = data.LanguageId }; return(finaldata); } catch (Exception) { return(null); } }
public IActionResult WhatWeDoDelete(int id) { bool datafound = _db.WhatWeDos.Any(t => t.Id == id); if (!datafound) { return(StatusCode(400, new ReturnErrorMessage((int)ErrorTypes.Errors.NotFound, message: "NotFound"))); } WhatWeDo data = _db.WhatWeDos.Find(id); WhatWeDoDTO dto = new WhatWeDoDTO { Id = id, Content = data.Content, LanguageId = data.LanguageId }; bool request = _wwd.Delete(dto); if (request) { return(Ok(new ReturnMessage(200, message: "Success"))); } return(StatusCode(500, new ReturnErrorMessage((int)ErrorTypes.Errors.Internal, message: "Internal server error"))); }