// GET: api/APICategory public IEnumerable <BusinessProcess.fieldCategory> Get() { BusinessProcess.CategoryManager cm = new BusinessProcess.CategoryManager(); var dd = cm.ListAll(); return(dd); }
// 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); }
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); }
// 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 }); }
// 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", "" }); } }