示例#1
0
        public void AddCheckListTask(string task)
        {
            Console.WriteLine($"Adding {task}");
            CheckListTask newCheckListTask = new CheckListTask();

            newCheckListTask.CreateTask(task);
            checkListTasks.Add(newCheckListTask);
        }
示例#2
0
 // POST api/<controller>
 public IHttpActionResult Post([FromBody] CheckListTask model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     repo.Create(model);
     return(Ok());
 }
示例#3
0
 public async void Create(CheckListTask CheckListTask)
 {
     try
     {
         using (Context)
         {
             Context.CheckListTask.Add(CheckListTask);
             await Context.SaveChangesAsync();
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
示例#4
0
 public async void Update(CheckListTask CheckListTask)
 {
     try
     {
         using (Context)
         {
             var update = FindbyId(CheckListTask.IdCheckListTask);
             update.IdTask = CheckListTask.IdTask;
             await Context.SaveChangesAsync();
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
示例#5
0
        // PUT api/<controller>/5
        public IHttpActionResult Put(int id, [FromBody] CheckListTask model)
        {
            if (!ModelState.IsValid || id != model.IdCheckListTask)
            {
                return(BadRequest(ModelState));
            }

            if (repo.FindbyId(id) == null)
            {
                return(NotFound());
            }
            else
            {
                repo.Update(model);
                return(Ok());
            }
        }
示例#6
0
        public void CreateTaskCheckListSendObject()
        {
            TaskCheckList taskCheckList = new TaskCheckList();

            taskCheckList.CreateTask("CreateTaskCheckListSendObject");
            CheckListTask checkListTask = new CheckListTask();

            checkListTask.CreateTask("checkListTask");
            taskCheckList.AddCheckListTask(checkListTask);
            List <CheckListTask> ListCheckList = taskCheckList.GetTaskCheckList();

            bool result = false;

            if (taskCheckList.GetTask().Contains("CreateTaskCheckListSendObject") &&
                ListCheckList[0].GetTask().Contains("checkListTask"))
            {
                result = true;
            }
            Assert.True(result, "result dont contain string");
        }
示例#7
0
 public void ChangeCheckListTask(int index, CheckListTask CheckListTask)
 {
     checkListTasks[index] = CheckListTask;
 }
示例#8
0
 public void AddCheckListTask(CheckListTask checkListTask)
 {
     checkListTasks.Add(checkListTask);
 }