// GET: /Edit public ActionResult Edit(int id, string languageCode) { //Get Item QueueMinderItemLanguage queueMinderItemLanguage = new QueueMinderItemLanguage(); queueMinderItemLanguage = queueMinderItemLanguageRepository.GetItem(id, languageCode); //Check Exists if (queueMinderItemLanguage == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check AccessRights QueueMinderItem queueMinderItem = new QueueMinderItem(); queueMinderItem = queueMinderItemRepository.GetItem(id); RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToQueueMinderGroup(queueMinderItem.QueueMinderGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } QueueMinderItemLanguageVM queueMinderItemLanguageVM = new QueueMinderItemLanguageVM(); queueMinderItemLanguageVM.QueueMinderItemLanguage = queueMinderItemLanguage; return(View(queueMinderItemLanguageVM)); }
//Delete From DB public void Delete(QueueMinderItemLanguage queueMinderItemLanguage) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_DeleteQueueMinderItemLanguage_v1( queueMinderItemLanguage.QueueMinderItemId, queueMinderItemLanguage.LanguageCode, adminUserGuid, queueMinderItemLanguage.VersionNumber ); }
//Add to DB public void Add(QueueMinderItemLanguage queueMinderItemLanguage) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_InsertQueueMinderItemLanguage_v1( queueMinderItemLanguage.QueueMinderItemId, queueMinderItemLanguage.LanguageCode, queueMinderItemLanguage.QueueMinderItemLanguageItineraryDescription, adminUserGuid ); }
public ActionResult Delete(QueueMinderItemLanguageVM queueMinderItemLanguageVM) { //Check QueueMinderItemLanguage Valid if (queueMinderItemLanguageVM.QueueMinderItemLanguage == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check QueueMinderItemLanguage Exists QueueMinderItemLanguage queueMinderItemLanguage = new QueueMinderItemLanguage(); queueMinderItemLanguage = queueMinderItemLanguageRepository.GetItem(queueMinderItemLanguageVM.QueueMinderItemLanguage.QueueMinderItemId, queueMinderItemLanguageVM.QueueMinderItemLanguage.LanguageCode); if (queueMinderItemLanguage == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //CHeck Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToQueueMinderGroup(queueMinderItemLanguage.QueueMinderItem.QueueMinderGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Delete Item try { queueMinderItemLanguageRepository.Delete(queueMinderItemLanguageVM.QueueMinderItemLanguage); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/QueueMinderItemLanguage.mvc/Delete/" + queueMinderItemLanguage.QueueMinderItemId.ToString() + "/" + queueMinderItemLanguage.LanguageCode; return(View("VersionError")); } //Generic Error ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } //Return return(RedirectToAction("List", new { id = queueMinderItemLanguage.QueueMinderItemId })); }
public ActionResult Delete(int id, string languageCode) { //Get Item QueueMinderItemLanguage queueMinderItemLanguage = new QueueMinderItemLanguage(); queueMinderItemLanguage = queueMinderItemLanguageRepository.GetItem(id, languageCode); //Check Exists if (queueMinderItemLanguage == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } QueueMinderItemLanguageVM queueMinderItemLanguageVM = new QueueMinderItemLanguageVM(); queueMinderItemLanguageVM.QueueMinderItemLanguage = queueMinderItemLanguage; return(View(queueMinderItemLanguageVM)); }
public ActionResult Create(int id) { //Get Item From Database QueueMinderItem queueMinderItem = new QueueMinderItem(); queueMinderItem = queueMinderItemRepository.GetItem(id); //Check Exists if (queueMinderItem == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToQueueMinderGroup(queueMinderItem.QueueMinderGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } QueueMinderItemLanguageVM queueMinderItemLanguageVM = new QueueMinderItemLanguageVM(); QueueMinderItemLanguage queueMinderItemLanguage = new QueueMinderItemLanguage(); queueMinderItemLanguage.QueueMinderItem = queueMinderItem; queueMinderItemLanguageVM.QueueMinderItemLanguage = queueMinderItemLanguage; SelectList queueMinderItemLanguages = new SelectList(queueMinderItemLanguageRepository.GetUnUsedLanguages(queueMinderItem.QueueMinderItemId).ToList(), "LanguageCode", "LanguageName"); queueMinderItemLanguageVM.QueueMinderItemLanguages = queueMinderItemLanguages; return(View(queueMinderItemLanguageVM)); }
public QueueMinderItemLanguageVM(QueueMinderItemLanguage queueMinderItemLanguage, IEnumerable <SelectListItem> queueMinderItemLanguages) { QueueMinderItemLanguage = queueMinderItemLanguage; QueueMinderItemLanguages = queueMinderItemLanguages; }