public IActionResult Create() { ViewBag.AboutUsParagraph = new SelectList(_database.AboutUsParagraph, "AboutUsParagraphId", "Body"); var _aboutUsBulletPoint = new AboutUsBulletPoint(); return(PartialView("Create", _aboutUsBulletPoint)); }
public async Task <IActionResult> Create(AboutUsBulletPoint aboutUsBulletPoint) { if (ModelState.IsValid) { aboutUsBulletPoint.CreatedBy = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid")); aboutUsBulletPoint.DateCreated = DateTime.Now; aboutUsBulletPoint.LastModifiedBy = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid")); aboutUsBulletPoint.DateLastModified = DateTime.Now; TempData["aboutusbulletpoint"] = "You have successfully added Meck Doramen And Associates's About Us Bullet Point!!!"; TempData["notificationType"] = NotificationType.Success.ToString(); await _database.AboutUsBulletPoint.AddAsync(aboutUsBulletPoint); await _database.SaveChangesAsync(); return(Json(new { success = true })); } ViewBag.AboutUsParagraph = new SelectList(_database.AboutUsParagraph, "AboutUsParagraphId", "Body", aboutUsBulletPoint.AboutUsParagraphId); return(View(aboutUsBulletPoint)); }
public async Task <IActionResult> Edit(int?id, AboutUsBulletPoint aboutUsBulletPoint) { if (id != aboutUsBulletPoint.AboutUsBulletPointId) { return(RedirectToAction("Index", "Error")); } if (ModelState.IsValid) { try { aboutUsBulletPoint.DateLastModified = DateTime.Now; aboutUsBulletPoint.LastModifiedBy = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid")); _database.AboutUsBulletPoint.Update(aboutUsBulletPoint); await _database.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AboutUsBulletPointExists(aboutUsBulletPoint.AboutUsBulletPointId)) { return(RedirectToAction("Index", "Error")); } else { throw; } } TempData["aboutusbulletpoint"] = "You have successfully modified Meck Doramen And Associates's About us Bullet Point !!!"; TempData["notificationType"] = NotificationType.Success.ToString(); return(Json(new { success = true })); } ViewBag.AboutUsParagraph = new SelectList(_database.AboutUsParagraph, "AboutUsParagraphId", "Body", aboutUsBulletPoint.AboutUsParagraphId); return(View(aboutUsBulletPoint)); }