Beispiel #1
0
 public ActionResult Index()
 {
     return(View(new HomeStatsViewModel()
     {
         Participants = ParticipantManager.Count(CurrentContextType),
         Entries = EntryManager.Count(CurrentContextType),
         Ingredients = IngredientManager.Count(CurrentContextType),
         ExistingBarCombinations = ExistingBarCombinationManager.Count(CurrentContextType),
         NewProCampaignTransactions = ProCampaignTransactionManager.CountByStatus(ProCampaignTransactionStatusKeys.NEW, CurrentContextType),
         SentProCampaignTransactions = ProCampaignTransactionManager.CountByStatus(ProCampaignTransactionStatusKeys.SENT, CurrentContextType)
     }));
 }
Beispiel #2
0
        public JsonResult List(int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
        {
            try
            {
                var dbRecords = IngredientManager.Get(jtStartIndex, jtPageSize, CurrentContextType).ToList();
                var records   = new List <object>();
                foreach (var dbRecord in dbRecords)
                {
                    records.Add(new
                    {
                        Id            = dbRecord.Id,
                        Name          = dbRecord.Name,
                        Colour        = dbRecord.Colour,
                        Category      = dbRecord.Category,
                        PackImagePath = dbRecord.PackImagePath,
                        CreatedOn     = String.Format(
                            "{0:yyyy-MM-dd hh:mm}",
                            dbRecord.CreatedOn
                            )
                    });
                }

                return(Json(new JTableResult
                {
                    Result = "OK",
                    Records = records,
                    TotalRecordCount = IngredientManager.Count(CurrentContextType)
                }));
            }
            catch (Exception ex)
            {
                return(Json(new JTableResult
                {
                    Result = "ERROR",
                    Message = ex.Message
                }));
            }
        }