Esempio n. 1
0
 public static Task AddTask(string name)
 {
     var repo = new TaskRepository();
     var task = new Task() {Name = name};
     repo.Add(task);
     return task;
 }
        public bool Delete(int id)
        {
            var repo = new TaskRepository();

            repo.Remove(id);

            return true;
        }
        public ActionResult Delete(int id)
        {
            var repo = new TaskRepository();

            repo.Remove(id);

            return Json(true);
        }
        public ActionResult AddTask(Task task)
        {
            var repo = new TaskRepository();
            repo.Add(task);

            if(Request.IsAjaxRequest())
            {
                return Json(task);
            }

            return new RedirectResult("/Home");
        }
        public CompleteResponse Complete(int id)
        {
            var repo = new TaskRepository();

            repo.Complete(id);

            var response = new CompleteResponse();
            response.success = id == 2;

            if (response.success)
                response.message = "Everything worked";
            else
                response.message = "There was an error";

            return response;
        }
Esempio n. 6
0
 protected void BindRepeater()
 {
     var repo = new TaskRepository();
     taskList.DataSource = repo.FindAll();
     taskList.DataBind();
 }
Esempio n. 7
0
 protected void addTask_Click(object sender, EventArgs e)
 {
     var repo = new TaskRepository();
     repo.Add(new Task() { Name = Name.Text });
 }
 public ActionResult Index()
 {
     var repo = new TaskRepository();
     ViewData["Tasks"] = repo.FindAll();
     return View();
 }