public ActionResult Create([FromBody] ProductReview productReview) { _db.Add(productReview); // Return a created at route to indicate where the resource can be found return(CreatedAtRoute("GetProductReview", new { id = productReview.Id }, productReview)); }
public ActionResult Create([FromBody] Todo todo) { dal.Add(todo); // Return a created at route to indicate where the resource can be found return(CreatedAtRoute("GetTodo", new { id = todo.id }, todo)); }
public int Add(int start, int amount) { int result = 0; //Call EntityFrmework or DataAccessLayer For Ado.net based on bool value if (_isEntityFramework) { using (var context = new CalculateEntities()) { object[] clientIdParameter = { new SqlParameter("@start", start), new SqlParameter("@amount", amount) }; result = context.Database.ExecuteSqlCommand("exec SP_Add @start, @amount", clientIdParameter); } } else { _dataAccessLayer = new DataAccessLayer(); result = _dataAccessLayer.Add(start, amount); } return(result); }
public ActionResult Create(ProductReview review) { dal.Add(review); return(CreatedAtRoute("GetProductById", new { id = review.Id }, review)); }