public IActionResult Delete(int id) { PeopleSay abs = _PeopleSayRepository.GetPeopleSayById(id); if (abs == null) return NotFound(); _PeopleSayRepository.DeletePeopleSay(abs); return RedirectToAction("index"); }
public IActionResult Create(PeopleSay PeopleSay) { if (ModelState.IsValid) { PeopleSay.CreatedBy = _admin.Fullname; _PeopleSayRepository.CreatePeopleSay(PeopleSay); return RedirectToAction("index"); } return View(PeopleSay); }
public void UpdatePeopleSay(PeopleSay PeopleSayToUpdate, PeopleSay model) { PeopleSayToUpdate.Status = model.Status; PeopleSayToUpdate.PersonName = model.PersonName; PeopleSayToUpdate.PersonJob = model.PersonJob; PeopleSayToUpdate.PersonImage = model.PersonImage; PeopleSayToUpdate.PersonComment = model.PersonComment; PeopleSayToUpdate.ModifiedBy = model.ModifiedBy; PeopleSayToUpdate.ModifiedAt = DateTime.Now; _context.SaveChanges(); }
public IActionResult Edit(PeopleSay abs) { if (ModelState.IsValid) { abs.ModifiedBy = _admin.Fullname; PeopleSay PeopleSayToUpdate = _PeopleSayRepository.GetPeopleSayById(abs.Id); if (PeopleSayToUpdate == null) return NotFound(); _PeopleSayRepository.UpdatePeopleSay(PeopleSayToUpdate, abs); return RedirectToAction("index"); } return View(abs); }
public void DeletePeopleSay(PeopleSay PeopleSay) { _context.PeopleSays.Remove(PeopleSay); _context.SaveChanges(); }
public void CreatePeopleSay(PeopleSay model) { model.CreatedAt = DateTime.Now; _context.PeopleSays.Add(model); _context.SaveChanges(); }
public IActionResult Edit(int id) { PeopleSay abs = _PeopleSayRepository.GetPeopleSayById(id); if (abs == null) return NotFound(); return View(abs); }