public List <BulletPoint> GetAllBulletPointsForPage(int pageId, bool isActive = true) { List <BulletPoint> bulletPointlList = new List <BulletPoint>(); using (var connection = _sqlConnection) { connection.Open(); SqlCommand command = new SqlCommand("BulletPointGetForPage", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@pageId", pageId)); command.Parameters.Add(new SqlParameter("@isActive", isActive)); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var bulletPoint = new BulletPoint { Id = DBValueToInt32(reader["BulletPointId"]), PageId = DBValueToInt32(reader["PageId"]), Content = DBValueToString(reader["Content"]), }; bulletPointlList.Add(bulletPoint); } } } return(bulletPointlList); }
public IActionResult Create() { ViewBag.Paragraph = new SelectList(_database.Paragraphs, "ParagraphId", "Body"); var bulletPoint = new BulletPoint(); return(PartialView("Create", bulletPoint)); }
public int UpsertBulletPointForPage(int pageId, int bulletPointId, BulletPoint data) { int rowsAffected = 0; using (var connection = _sqlConnection) { connection.Open(); SqlCommand command = new SqlCommand("BulletPointUpsertForPage", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@pageId", pageId)); command.Parameters.Add(new SqlParameter("@bulletPointId", bulletPointId)); command.Parameters.Add(new SqlParameter("@newContent", data.Content)); command.Parameters.Add(new SqlParameter("@newPageId", data.PageId)); rowsAffected = command.ExecuteNonQuery(); } return(rowsAffected); }
public async Task <IActionResult> Edit(int?id, BulletPoint bulletPoint) { if (id != bulletPoint.BulletPointId) { return(RedirectToAction("Index", "Error")); } if (ModelState.IsValid) { try { bulletPoint.DateLastModified = DateTime.Now; bulletPoint.LastModifiedBy = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid")); _database.BulletPoints.Update(bulletPoint); await _database.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BulletPointsExists(bulletPoint.BulletPointId)) { return(RedirectToAction("Index", "Error")); } else { throw; } } TempData["bulletpoint"] = "You have successfully modified Meck Doramen And Associates's Paragraph !!!"; TempData["notificationType"] = NotificationType.Success.ToString(); return(Json(new { success = true })); } ViewBag.Paragraph = new SelectList(_database.Paragraphs, "ParagraphId", "Body", bulletPoint.BulletPointId); return(View(bulletPoint)); }
public async Task <IActionResult> Create(BulletPoint bulletPoint) { if (ModelState.IsValid) { bulletPoint.CreatedBy = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid")); bulletPoint.DateCreated = DateTime.Now; bulletPoint.LastModifiedBy = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid")); bulletPoint.DateLastModified = DateTime.Now; await _database.BulletPoints.AddAsync(bulletPoint); await _database.SaveChangesAsync(); TempData["bulletpoint"] = "You have successfully added a Meck Doramen And Associates's Bullet Point !!!"; TempData["notificationType"] = NotificationType.Success.ToString(); return(Json(new { success = true })); } ViewBag.Paragraph = new SelectList(_database.Paragraphs, "ParagraphId", "Name", bulletPoint.ParagraphId); return(View(bulletPoint)); }
public void UpsertBulletPointForPage(int pageId, int bulletPointId, BulletPoint data) { _bulletPointDM.UpsertBulletPointForPage(pageId, bulletPointId, data); }
public IActionResult UpsertBulletPointToPage([FromRoute] int pageId, [FromRoute] int bulletPointId, [FromBody] BulletPoint data) { BulletPointService bulletPointService = new BulletPointService(Settings.GetSection("AppSettings").GetSection("DefaultConnectionString").Value); bulletPointService.UpsertBulletPointForPage(pageId, bulletPointId, data); return(Ok()); }