public ActionResult DeleteMarketWording(MarketWording marketWording)
        {
            var result = AdminModuleManager.DeleteMarketWording(marketWording);

            return(new JsonNetResult
            {
                Data = result
            });
        }
        public ActionResult EditMarketWording(MarketWording marketWording)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpException(406, "Not Acceptable - Invalid Data");
            }



            var updatedMarketWording = AdminModuleManager.EditMarketWording(marketWording);

            return(new JsonNetResult
            {
                Data = updatedMarketWording
            });
        }
        public string DeleteMarketWording(MarketWording marketWording)
        {
            using (ConsoleRepository)
            {
                try
                {
                    ConsoleRepository.Attach(marketWording);
                    ConsoleRepository.Delete(marketWording);
                    ConsoleRepository.SaveChanges();
                    return "Success";
                }
                catch (Exception ex)
                {
                    return "Failed";
                }

            }
        }
      public MarketWording EditMarketWording(MarketWording marketWording)
      {
          using (var transactopnScope = new System.Transactions.TransactionScope(TransactionScopeOption.Required,
 new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted }))
          using (ConsoleRepository)
          {
              ConsoleRepository.Query<MarketWording>(mw => mw.Id == marketWording.Id).First().Title = marketWording.Title;
              //ConsoleRepository.Attach(marketWording);
              ConsoleRepository.SaveChanges();
              //Get the new version
              var newMarketWording =
                  ConsoleRepository.Query<MarketWording>(mw => mw.Key == marketWording.Key && mw.IsObsolete == false)
                                   .First();
              var affectedTeamOfficeSettings =
                  ConsoleRepository.Query<MarketWordingSetting>(mws => mws.MarketWording.Key == marketWording.Key).ToList();
              foreach (var affectedTeamOfficeSetting in affectedTeamOfficeSettings)
              {
                  affectedTeamOfficeSetting.MarketWording = newMarketWording;
              }
              ConsoleRepository.SaveChanges();
              transactopnScope.Complete();
              return newMarketWording;
          }
      }
 public MarketWording CreateMarketWording(MarketWording marketWording)
 {
     using (ConsoleRepository)
     {
         ConsoleRepository.Add(marketWording);
         ConsoleRepository.SaveChanges();
         return marketWording;
     }
 }
        public ActionResult DeleteMarketWording(MarketWording marketWording)
        {
            try
            {
                var result = _adminModuleManager.DeleteMarketWording(marketWording);

                return new JsonNetResult
                {
                    Data = result
                };
            }
			catch (Exception ex) // TODO: Remove
            {
                _logHandler.WriteLog(ex.ToString(), LogSeverity.Error, LogCategory.BusinessComponent);
                throw new HttpException(500, "Server Error");
            }
        }
        public ActionResult EditMarketWording(MarketWording marketWording)
        {
            if (!ModelState.IsValid)
				throw new HttpException(406, "Not Acceptable - Invalid Data"); // TODO: Use Http status code enum and cast

            try
            {
                var updatedMarketWording = _adminModuleManager.EditMarketWording(marketWording);

                return new JsonNetResult
                {
                    Data = updatedMarketWording
                };
            }
			catch (Exception ex) // TODO: Remove
            {
                _logHandler.WriteLog(ex.ToString(), LogSeverity.Error, LogCategory.BusinessComponent);
                throw new HttpException(500, "Server Error");
            }
        }