Exemplo n.º 1
0
        public int DeleteHobby(DeleteHobby deleteHobby)
        {
            ObjectParameter result = new ObjectParameter("Result", typeof(int));

            using (TestingSample1Entities dataContext = new TestingSample1Entities())
            {
                dataContext.HobbyDelete(deleteHobby.HobbyId, result);
            }
            return(Convert.ToInt32(result.Value));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            int result = 0;

            try
            {
                DeleteHobby deleteHobby = new DeleteHobby()
                {
                    HobbyId = id
                };
                result = iHobby.DeleteHobby(deleteHobby);
            }
            catch
            {
                result = -1;
            }
            return(Json(result));
        }