public dynamic UpdateCategory([FromBody] Newtonsoft.Json.Linq.JObject param) { dynamic result = null; try { dynamic dd = param; string category_id = dd.category_id; int post_id = dd.post_id; // tbl_category c = new tbl_category(); dynamic c = _repositoryWrapper.Post_Category_Repository.GetPostByPostID(post_id); tbl_post_category category = c as tbl_post_category; category.category_id = category_id; category.post_id = post_id; _repositoryWrapper.Post_Category_Repository.Update(category); result = new { Status = 1, Message = "Update Successfully", data = new { } }; } catch (Exception ex) { result = new { Status = 0, Message = "Update Fail", data = new { } }; Console.WriteLine(ex.Message); } return(result); }
public dynamic SaveCategory([FromBody] Newtonsoft.Json.Linq.JObject param) { dynamic result = null; try { dynamic dd = param; string category_id = dd.category_id; int post_id = dd.post_id; tbl_post_category c = new tbl_post_category(); c.category_id = category_id; c.post_id = post_id; _repositoryWrapper.Post_Category_Repository.Create(c); result = new { Status = 1, Message = "Save Successfully", data = new { } }; } catch (Exception ex) { result = new { Status = 0, Message = "Save Fail", data = new { } }; Console.WriteLine(ex.Message); } return(result); }