Esempio n. 1
0
        public int GetTotalForCategory(DanceCategory cat)
        {
            switch (cat)
            {
            case DanceCategory.Standard:
                return(TotalStandard);

            case DanceCategory.Latin:
                return(TotalLatin);

            case DanceCategory.Smooth:
                return(TotalSmooth);

            case DanceCategory.Rhythm:
                return(TotalRhythm);

            case DanceCategory.Swing:
                return(TotalSwing);

            case DanceCategory.Social:
                return(TotalSocial);

            case DanceCategory.Competition:
                return(TotalCompetition);

            default:
                throw new Exception($"Unexpected DanceCategory {cat}");
            }
        }
 public IActionResult PostCreateDance(DanceCategory danceCategory)
 {
     if (ModelState.IsValid)
     {
         paymentsDatabaseRepository.createDanceCategory(danceCategory);
         return(RedirectToAction("Index"));
     }
     return(View("CreateDance"));
 }
 public void createDanceCategory(DanceCategory danceCategory)
 {
     worker.run(context =>
     {
         context
         .createCommand("INSERT INTO MARIADEMO.GNB_DANCES (CATEGORY, COST) VALUES (:CATEGORY, :COST)")
         .addStringInParam("CATEGORY", danceCategory.danceName)
         .addNumericInParam("COST", danceCategory.cost)
         .execute();
     });
 }
 public void editDanceCategory(DanceCategory danceCategory)
 {
     worker.run(context =>
     {
         context
         .createCommand("UPDATE MARIADEMO.GNB_DANCES SET CATEGORY=:CATEGORY , COST=:COST WHERE CATEGORY_ID=:CATEGORY_ID")
         .addStringInParam("CATEGORY", danceCategory.danceName)
         .addNumericInParam("COST", danceCategory.cost)
         .addNumericInParam("CATEGORY_ID", danceCategory.danceId)
         .execute();
     });
 }
        public DanceCategory getDanceCategory(int id)
        {
            DanceCategory category = null;

            worker.run(context =>
            {
                category = context
                           .createCommand("SELECT * FROM MARIADEMO.GNB_DANCES WHERE CATEGORY_ID = :CATEGORY_ID")
                           .addNumericInParam("CATEGORY_ID", id)
                           .first <DanceCategory>();
            });

            return(category);
        }
Esempio n. 6
0
        public void SetTotalForCategory(DanceCategory cat, int total)
        {
            switch (cat)
            {
            case DanceCategory.Standard:
                TotalStandard = total;
                break;

            case DanceCategory.Latin:
                TotalLatin = total;
                break;

            case DanceCategory.Smooth:
                TotalSmooth = total;
                break;

            case DanceCategory.Rhythm:
                TotalRhythm = total;
                break;

            case DanceCategory.Swing:
                TotalSwing = total;
                break;

            case DanceCategory.Social:
                TotalSocial = total;
                break;

            case DanceCategory.Competition:
                TotalCompetition = total;
                break;

            default:
                throw new Exception($"Unexpected DanceCategory {cat}");
            }
        }
Esempio n. 7
0
 public TempoRange GetTempo(DanceCategory category)
 {
     return(_tempos[category]);
 }
Esempio n. 8
0
 public static DanceCategories ToCategoriesMask(DanceCategory category)
 {
     return((DanceCategories)(1 << (int)category));
 }
 public IActionResult PostEdit(DanceCategory danceCategory)
 {
     paymentsDatabaseRepository.editDanceCategory(danceCategory);
     return(RedirectToAction("Index"));
 }