public void AddCheckListTask(string task) { Console.WriteLine($"Adding {task}"); CheckListTask newCheckListTask = new CheckListTask(); newCheckListTask.CreateTask(task); checkListTasks.Add(newCheckListTask); }
// POST api/<controller> public IHttpActionResult Post([FromBody] CheckListTask model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } repo.Create(model); return(Ok()); }
public async void Create(CheckListTask CheckListTask) { try { using (Context) { Context.CheckListTask.Add(CheckListTask); await Context.SaveChangesAsync(); } } catch (Exception ex) { Console.Write(ex); } }
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); } }
// 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()); } }
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"); }
public void ChangeCheckListTask(int index, CheckListTask CheckListTask) { checkListTasks[index] = CheckListTask; }
public void AddCheckListTask(CheckListTask checkListTask) { checkListTasks.Add(checkListTask); }