Beispiel #1
0
        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));
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public ActionResult Create(ProductReview review)
 {
     dal.Add(review);
     return(CreatedAtRoute("GetProductById", new { id = review.Id }, review));
 }