コード例 #1
0
        public async Task <IEnumerable <result> > AddEmployee(Employees emp)
        {
            IEnumerable <result> res = new List <result>();;

            try {
                SqlParameter FirstNameParam  = new SqlParameter("@p_FirstName", emp.FirstName);
                SqlParameter LastNameParam   = new SqlParameter("@p_LastName", emp.LastName);
                SqlParameter EmailIDParam    = new SqlParameter("@p_EmailID", emp.EmailID);
                SqlParameter ActivitiesParam = new SqlParameter("@p_Activities", emp.Activities);
                SqlParameter CommentsParam   = new SqlParameter("@p_Comments", emp.Comments);
                //var result = await _db.Set<result>().FromSqlRaw(@"EXEC [dbo].[usp_AddEmp] @p_FirstName, @p_LastName, @p_EmailID, @p_Activities, @p_Comments", FirstNameParam, LastNameParam, EmailIDParam, ActivitiesParam, CommentsParam).AsNoTracking().SingleOrDefaultAsync();
                res = await _db.Set <result>().FromSqlRaw(@"EXEC [dbo].[usp_AddEmp] @p_FirstName, @p_LastName, @p_EmailID, @p_Activities, @p_Comments", FirstNameParam, LastNameParam, EmailIDParam, ActivitiesParam, CommentsParam).AsNoTracking().ToListAsync();

                //return result.AsEnumerable();
            }
            catch (Exception e)
            {
            }
            //return res[0].Result;
            return(res);
        }