コード例 #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}");
            }
        }
コード例 #2
0
 public IActionResult PostCreateDance(DanceCategory danceCategory)
 {
     if (ModelState.IsValid)
     {
         paymentsDatabaseRepository.createDanceCategory(danceCategory);
         return(RedirectToAction("Index"));
     }
     return(View("CreateDance"));
 }
コード例 #3
0
 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();
     });
 }
コード例 #4
0
 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();
     });
 }
コード例 #5
0
        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);
        }
コード例 #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}");
            }
        }
コード例 #7
0
 public TempoRange GetTempo(DanceCategory category)
 {
     return(_tempos[category]);
 }
コード例 #8
0
 public static DanceCategories ToCategoriesMask(DanceCategory category)
 {
     return((DanceCategories)(1 << (int)category));
 }
コード例 #9
0
 public IActionResult PostEdit(DanceCategory danceCategory)
 {
     paymentsDatabaseRepository.editDanceCategory(danceCategory);
     return(RedirectToAction("Index"));
 }