public static int SaveNotes(NotesDbModel Model)
        {
            var outParam = new SqlParameter();

            outParam.ParameterName = "Id";
            outParam.Value         = Model.Id;
            outParam.SqlDbType     = SqlDbType.BigInt;
            outParam.Direction     = ParameterDirection.InputOutput;
            int result = 0;

            using (var Context = new CRMContext())
            {
                Context.Database.ExecuteSqlCommand(
                    "exec [dbo].[usp_Sales_Notes_Save] @Id OUT,@Name,@Description,@ContactId,@CreatedBy,@IsActive",
                    new Object[]
                {
                    outParam,
                    new SqlParameter("Name", Model.Name),
                    new SqlParameter("Description", Model.Description),
                    new SqlParameter("ContactId", Model.ContactId),
                    new SqlParameter("CreatedBy", Model.CreatedBy),
                    new SqlParameter("IsActive", Model.IsActive)
                }
                    );
            }
            result = Convert.ToInt32(outParam.Value);
            return(result);
        }
 public static int SaveNoteLinks(NotesDbModel Model)
 {
     using (var Context = new CRMContext())
     {
         return(Context.Database.ExecuteSqlCommand(
                    "exec dbo.[usp_Sales_NoteLinks_Save] @Id,@NoteId,@LinkId,@LinkType",
                    new Object[]
         {
             new SqlParameter("Id", Model.NoteLinkId),
             new SqlParameter("NoteId", Model.Id),
             new SqlParameter("LinkId", Model.LinkId),
             new SqlParameter("LinkType", (int)Model.LinkType)
         }
                    ));
     }
 }