示例#1
0
        // GET: api/APICategory
        public IEnumerable <BusinessProcess.fieldCategory> Get()
        {
            BusinessProcess.CategoryManager cm = new BusinessProcess.CategoryManager();
            var dd = cm.ListAll();

            return(dd);
        }
示例#2
0
        // DELETE: api/APICategory/5
        public string Delete(int id)
        {
            BusinessProcess.CategoryManager cm = new BusinessProcess.CategoryManager();
            string idData = id.ToString();
            var    data   = cm.Delete(idData);

            return(data);
        }
示例#3
0
        public void tambah_kategori()
        {
            string idnya    = Guid.NewGuid().ToString();
            var    kategori = new DataModel.Category {
                Id = idnya, Name = "Apa Aja"
            };

            BusinessProcess.CategoryManager cm = new BusinessProcess.CategoryManager();
            cm.Add(kategori);
        }
示例#4
0
        // PUT: api/APICategory/5
        public IEnumerable <string> Update(string id, [FromBody] DataModel.Category category)
        {
            BusinessProcess.CategoryManager cm = new BusinessProcess.CategoryManager();
            string idData = id.ToString();

            category = new DataModel.Category {
                Id = idData, Name = category.Name
            };
            var data = cm.Update(idData, category);

            return(new string[] { "info", data });
        }
示例#5
0
 // POST: api/APICategory
 public IEnumerable <string> Post([FromBody] DataModel.Category category)
 {
     if (ModelState.IsValid)
     {
         BusinessProcess.CategoryManager cm = new BusinessProcess.CategoryManager();
         string idData = Guid.NewGuid().ToString();
         category = new DataModel.Category {
             Id = idData, Name = category.Name
         };
         var data = cm.Add(category);
         return(new string[] { "info", data });
     }
     else
     {
         return(new string[] { "info", "" });
     }
 }