public IActionResult Create()
        {
            ViewBag.MarketResearch = new SelectList(_database.MarketResearches, "MarketResearchId", "Name");

            var _marketResearchParagraph = new MarketResearchParagraph();

            return(PartialView("Create", _marketResearchParagraph));
        }
        public async Task <IActionResult> Create(MarketResearchParagraph marketResearchParagraph)
        {
            if (ModelState.IsValid)
            {
                marketResearchParagraph.CreatedBy        = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid"));
                marketResearchParagraph.DateCreated      = DateTime.Now;
                marketResearchParagraph.LastModifiedBy   = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid"));
                marketResearchParagraph.DateLastModified = DateTime.Now;

                TempData["marketresearchparagraph"] = "You have successfully added Meck Doramen And Associates's Market Research !!!";
                TempData["notificationType"]        = NotificationType.Success.ToString();

                await _database.MarketResearchParagraphs.AddAsync(marketResearchParagraph);

                await _database.SaveChangesAsync();

                return(Json(new { success = true }));
            }

            ViewBag.MarketResearch = new SelectList(_database.MarketResearches, "MarketResearchId", "Name", marketResearchParagraph.MarketResearchId);
            return(View(marketResearchParagraph));
        }
        public async Task <IActionResult> Edit(int?id, MarketResearchParagraph marketResearchParagraph)
        {
            if (id != marketResearchParagraph.MarketResearchParagraphId)
            {
                return(RedirectToAction("Index", "Error"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    marketResearchParagraph.DateLastModified = DateTime.Now;
                    marketResearchParagraph.LastModifiedBy   = Convert.ToInt32(_session.GetInt32("MDnAloggedinuserid"));

                    _database.Update(marketResearchParagraph);
                    await _database.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MarketResearchParagraphExists(marketResearchParagraph.MarketResearchParagraphId))
                    {
                        return(RedirectToAction("Index", "Error"));
                    }
                    else
                    {
                        throw;
                    }
                }
                TempData["marketresearchparagraph"] = "You have successfully modified Meck Doramen And Associates's Market Research Paragraph !!!";
                TempData["notificationType"]        = NotificationType.Success.ToString();

                return(Json(new { success = true }));
            }

            return(View(marketResearchParagraph));
        }