public IActionResult SliceLoaf(int id)
        {
            //task based api with crud repo
            var loaf = _repo.Get(id);

            loaf.Sliced = true;
            _repo.Update(loaf);

            //task based api with task based repo
            _repo.Slice(id);

            return(NoContent());
        }
Example #2
0
        public IActionResult SliceLoaf(int id)
        {
            //Option 1:
            //less efficient
            var loaf = _repo.Get(id);

            loaf.Sliced = true;

            _repo.Update(loaf);

            //Option 2:
            //more efficient
            _repo.Slice(id);

            //Constant
            return(NoContent());
        }