コード例 #1
0
        // DELETE api/<controller>/5
        public void Delete(int id)
        {
            AngularTasksEntities ate = new AngularTasksEntities();
            Task t = ate.Tasks.Where(a => a.quotenum == id).FirstOrDefault();

            if (t != null)
            {
                ate.Tasks.Remove(t);
                ate.SaveChanges();
            }
        }
コード例 #2
0
        // PUT api/<controller>/5
        public void Put(int id, string Qtype, string contact, string task, DateTime duedate, string Ttype)
        {
            AngularTasksEntities ate = new AngularTasksEntities();
            Task t = ate.Tasks.Where(a => a.quotenum == id).FirstOrDefault();

            if (t != null)
            {
                t.quotetype = Qtype;
                t.contact   = contact;
                t.task1     = task;
                t.duedate   = duedate;
                t.tasktype  = Ttype;
            }
            ate.SaveChanges();
        }
コード例 #3
0
        // POST api/<controller>
        public void Post(string Qtype, string contact, string task, DateTime duedate, string Ttype)
        {
            AngularTasksEntities ate = new AngularTasksEntities();
            Task t = new Task
            {
                quotetype = Qtype,
                contact   = contact,
                task1     = task,
                duedate   = duedate,
                tasktype  = Ttype
            };

            ate.Tasks.Add(t);
            ate.SaveChanges();
        }
コード例 #4
0
        // GET api/<controller>/5
        public Task Get(int id)
        {
            AngularTasksEntities ate = new AngularTasksEntities();

            return(ate.Tasks.Where(a => a.quotenum == id).FirstOrDefault());
        }
コード例 #5
0
        // GET api/<controller>
        public IEnumerable <Task> Get()
        {
            AngularTasksEntities ate = new AngularTasksEntities();

            return(ate.Tasks.ToList());
        }