Example #1
0
 async public static Task <int> RegisterTaskAsync(EachTask newTask)
 {
     using (var db = new MemoAppContext())
     {
         db.EachTasks.Add(newTask);
         return(await db.SaveChangesAsync());
     }
 }
Example #2
0
 async public static Task ChangeComplateFlag(string targetTaskId, bool flagValue)
 {
     using (var db = new MemoAppContext())
     {
         EachTask targetTask = db.EachTasks.Where(eachTask => eachTask.EachTaskId == targetTaskId).FirstOrDefault();
         targetTask.CompleteFlag = flagValue;
         await db.SaveChangesAsync();
     }
 }
Example #3
0
 async public static Task UpdateTaskRankAsync(string newTaskId, int rank)
 {
     using (var db = new MemoAppContext())
     {
         EachTask targetTask = db.EachTasks.Where(eachTask => eachTask.EachTaskId == newTaskId).FirstOrDefault();
         targetTask.Rank = rank;
         await db.SaveChangesAsync();
     }
 }
Example #4
0
        public async static Task UpdateSpecificConfigAsync(ConfigType configType, string value)
        {
            using (var db = new MemoAppContext())
            {
                Config targetConfig = db.Configs.Where(config => config.ConfigId == configType.ToString()).FirstOrDefault();

                if (targetConfig == null)
                {
                    Config newConfig = new Config()
                    {
                        ConfigId = configType.ToString(),
                        Value    = value
                    };

                    db.Configs.Add(newConfig);
                }
                else
                {
                    targetConfig.Value = value;
                }

                await db.SaveChangesAsync();
            }
        }