/// <summary> /// Function for add concept theme /// </summary> /// <param name="theme_VM"></param> /// <param name="loginUserId"></param> /// <returns></returns> public int Add(ConceptTheme_VM conceptTheme_VM, int loginUserId) { var conceptTheme = new Concept_Theme(); conceptTheme.ConceptId = conceptTheme_VM.ConceptId; conceptTheme.LogoName = conceptTheme_VM.LogoName; conceptTheme.FeedBackIconName = conceptTheme_VM.FeedBackIconName; conceptTheme.ColorCode = conceptTheme_VM.ColorCode; conceptTheme.Status = conceptTheme_VM.Status; conceptTheme.CreatedOn = DateTime.Now; conceptTheme.CreatedBy = loginUserId; _context.Concept_Theme.Add(conceptTheme); return(_context.SaveChanges()); }
/// <summary> /// Function for update concept theme /// </summary> /// <param name="theme_VM"></param> /// <param name="loginUserId"></param> /// <returns></returns> public int Update(ConceptTheme_VM conceptTheme_VM, int loginUserId) { var conceptTheme = _context.Concept_Theme.Where(x => x.ConceptId == conceptTheme_VM.ConceptId && !x.IsDeleted).FirstOrDefault(); if (conceptTheme != null) { conceptTheme.LogoName = conceptTheme_VM.LogoName; conceptTheme.FeedBackIconName = conceptTheme_VM.FeedBackIconName; conceptTheme.ColorCode = conceptTheme_VM.ColorCode; conceptTheme.Status = conceptTheme_VM.Status; conceptTheme.ModifiedBy = loginUserId; conceptTheme.ModifiedOn = DateTime.Now; return(_context.SaveChanges()); } return(0); }
public async Task <IActionResult> SaveAsync(ConceptTheme_VM conceptTheme_VM) { if (conceptTheme_VM != null) { if (conceptTheme_VM.LogoImage != null && conceptTheme_VM.LogoImage.Length > 0) { conceptTheme_VM.LogoName = await Helper.FileUploadAsync(path, conceptTheme_VM.LogoImage); } if (conceptTheme_VM.FeedBackIcon != null && conceptTheme_VM.FeedBackIcon.Length > 0) { conceptTheme_VM.FeedBackIconName = await Helper.FileUploadAsync(path, conceptTheme_VM.FeedBackIcon); } if (conceptTheme_VM.Id > 0) { if (_conceptThemeRepository.Update(conceptTheme_VM, this.loginUserId) > 0) { TempData["Status"] = Helper.success_code; TempData["Message"] = Message.conceptThemeUpdated; } else { TempData["Message"] = Message.conceptThemeUpdateError; } } else { if (_conceptThemeRepository.Add(conceptTheme_VM, this.loginUserId) > 0) { TempData["Status"] = Helper.success_code; TempData["Message"] = Message.conceptThemeAdded; } else { TempData["Message"] = Message.conceptThemeAddedError; } } } return(RedirectToAction("List", "ConceptTheme")); }
public IActionResult Index(int Id = 0) { ViewBag.ConceptsList = new SelectList(conceptsList, "Id", "ConceptName"); var conceptTheme = new ConceptTheme_VM(); if (Id > 0) { conceptTheme = _conceptThemeRepository.Get(Id, loginUserId); if (conceptTheme == null) { return(RedirectToAction("List", "ConceptTheme")); } else { ViewData["Title"] = "Edit"; return(View(conceptTheme)); } } else { ViewData["Title"] = "Add"; return(View(conceptTheme)); } }